setup.py sdist exclude packages in subdirectory

find_packages(“src”, exclude=[“test”]) works. The trick is to remove stale files such as core.egg-info directory. In your case you need to remove src/core.egg-info. Here’s setup.py I’ve used: from setuptools import setup, find_packages setup(name=”core”, version=’0.1′, package_dir={”:’src’}, packages=find_packages(“src”, exclude=[“test”]), # <- test is excluded ####packages=find_packages(“src”), # <- test is included author=”J.R. Hacker”, author_email=”[email protected]”, url=”http://stackoverflow.com/q/26545668/4279″, package_data={‘core’: [‘config/*.tmpl’]}, ) To … Read more

Distributing multiple packages using setup.py for Python

I may have answered my own question: If I modify the setup.py to use: packages = find_packages(), and change the directory structure to: … |-package1 | |-setup.py | |-MANIFEST.in | |-com (symlink to ../com) | |-utilities (symlink to ../utilities) | |-package1 | | |-__init__.py | | |-package1_1.py | | |-package1_2.py | | |-… If I … Read more

What does the `platforms` argument to `setup()` in `setup.py` do?

platforms is an argument the setuptools package inherits from distutils; see the Additional meta-data section in the distutils documentation: Meta-Data: platforms Description: a list of platforms Value: list of strings So, yes, using a list is the correct syntax. The field just provides metadata; what platforms does the package target. Use this to communicate to … Read more

How can I use setuptools to generate a console_scripts entry point which calls `python -m mypackage`?

How can I use entry_points to generate a binary that calls python -m mypackage (and passes *args, **kwargs) ? I think this is the wrong way to look at the problem. You don’t want your script to call python -m mypackage, but you want the script to have the same entry point as python -m … Read more

Pipenv vs setup.py

Update: pipenv 9.0.0 has been released, which should allow you to use pipenv install -e . as expected. Original answer: pipenv install -e is buggy and has been fixed in master (pull request). It will be available in the next release, sometime after Thanksgiving. Temporary workaround for now is: pipenv shell pip install -e . … Read more

How do I force `setup.py test` to install dependencies into my `virtualenv`?

By design, you can’t make the tests_requires or the setup_requires entries go into the virtual environment. The idea is to separate what is required for performing tests/setup and what is required to actually use the package being installed. For example, I may require that the “coverage” module be needed for running tests on my package, … Read more

tech