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 create distributives, run:

$ python setup.py sdist bdist bdist_wheel

To enable the latter command, run: pip install wheel.

I’ve inspected created files. They do not contain test but contain core/__init__.py, core/config/log.tmpl files.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)