I'm trying to put a Python project into a tarball using setuptools. The problem is that setuptools doesn't appear to like the way that the source tree was originally setup (not by me, I must add). Everything that I actually want to distribute is in the top-level directory, rather than in a subdirectory like the setuptools docs talk about.
The tree has a directory, tests
, that I don't want to have in the released package. However, using exclude_package_data
doesn't seem to actually do any excluding, and I'd like to work out what I've done wrong.
My setup.py
looks like this, in relevant part:
setup( name="project", packages=[''], include_package_data=True, exclude_package_data={'': ['tests']}, test_suite='nose.collector', )
Setuptools is a collection of enhancements to the Python distutils that allow developers to more easily build and distribute Python packages, especially ones that have dependencies on other packages. Packages built and distributed using setuptools look to the user like ordinary Python packages based on the distutils .
In Fedora, our pip package Recommends setuptools. Practically that means: Majority of users who install pip will get setuptools by default. Users can explicitly uninstall setuptools after installing pip or exclude setuptools when installing pip.
the setuptools is not part of the python vanilla codebase, hence not a vanilla modules. python.org installers or mac homebrew will install it for you, but if someone compile the python by himself or install it on some linux distribution he may not get it and will need to install it by himself.
setup. cfg is a cheekily named Python package which supports providing all of a Python distribution's metadata and build configuration via the setup. cfg file at the base of the distribution's source tree, rather than in the setup.py script. The standard setup.py script is reduced to a stub which uses the setup.
We use the following convention to exclude 'tests' from packages.
setup( name="project", packages=find_packages(exclude=("tests",)), include_package_data=True, test_suite='nose.collector', )
We also use MANIFEST.in to better control what include_package_data=True
does.
I have wasted several hours on the same problem, trying to exclude a module, I finally found that I had to remove the *.egg-info
and build
directories, that somehow retained the idea that the module had to be included.
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