Search code examples
pythonsetuptoolssoftware-distribution

Empty directories with Setuptools


How to include empty directories in a source or built Python distribution with Setuptools?

Directory layout:

project
├─ src
|  └─ package
|     ├─ __main__.py
|     ├─ data.tsv
|     ├─ module.py
|     └─ plugins
├─ tests
|  └─ test_module.py
├─ MANIFEST.in
├─ README.rst
└─ setup.py

setup.py:

import setuptools

setuptools.setup(
    name="project",
    version="0.1.0",
    url="https://project.org/",
    author="Maggyero",
    author_email="maggyero@project.org",
    package_dir={"": "src"},
    packages=setuptools.find_namespace_packages("src"),
    include_package_data=True
)

MANIFEST.in:

graft src
graft tests
global-exclude *.py[cod]

Currently the empty plugins directory is not included.


Solution

  • I'm sure the proper way is not to include empty directories at all and only create them when needed.