I'm working on a Python package that uses namespace_packages
and find_packages()
like so in setup.py:
from setuptools import setup, find_packages
setup(name="package",
version="1.3.3.7",
package=find_packages(),
namespace_packages=['package'], ...)
It isn't in source control because it is a bundle of upstream components. There is no MANIFEST.
When I run python setup.py sdist
I get a tarball of most of the files under the package/
directory but any directories that don't contain .py
files are left out.
What are the default rules for what setup.py
includes and excludes from built distributions? I've fixed my problem by adding a MANIFEST.in
with
recursive-include package *
but I would like to understand what setuptools and distutils are doing by default.
You need to add a package_data directive. For example, if you want to include files with .txt or .rst extensions:
from setuptools import setup, find_packages
setup(name="package",
version="1.3.3.7",
package=find_packages(),
include_package_data=True,
namespace_packages=['package'],
package_data = {
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst']...
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With