I'm trying to build a package for a django application, but excluding all tests modules. I have tried setting
exclude = ["*.tests", "*.tests.*", "tests.*", "tests"]
on find_packages
and defining a MANIFEST.in
, but the tests are always compiled and included in the bundle.
Any clues?
package_dir = {'': 'lib'} in your setup script. The keys to this dictionary are package names, and an empty package name stands for the root package. The values are directory names relative to your distribution root.
(assuming you haven't specified any sdist options in the setup script or config file), sdist creates the archive of the default format for the current platform. The default format is a gzip'ed tar file ( . tar. gz ) on Unix, and ZIP file on Windows.
To build a source distribution, use the command line to navigate to the directory containing setup.py, and run the command python setup.py sdist.
I found the combination both adding find_packages
rule and writing out MANIFEST.in
rules i.e. prune tests
Note that for python 3.2 and older you must have __init__.py
in tests root, for find_packages
command to consider tests folder to be a package.
Sample find_packages
exclude command in setup.py
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
Sample MANIFEST.in
include *.txt *.ini *.cfg *.rst
recursive-include fmcc *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
prune tests
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