Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setuptools not properly excluding tests

My package structure is

package
   |-setup.py
   |-package
   |   |-__init__.py
   |   |-source.py
   |-test
       |-__init__.py
       |-test_source.py

I've got the line packages=find_packages(exclude=['test']) in my call to setup() in my package's setup.py.

If I python3 setup.py sdist bdist_wheel, then navigate in to dist/ and unzip the .tar.gz, I can see the test directory is in the distribution.

I specifically told setup not to do this. Why is that there? I can't figure out how to make it stop.

like image 676
Pavel Komarov Avatar asked Feb 27 '26 06:02

Pavel Komarov


1 Answers

Test files are included by default:

The following files are included in a source distribution by default:

  • all files matching the pattern test/test*.py

You can use a MANIFEST.in with prune test.

like image 169
Ry- Avatar answered Mar 01 '26 18:03

Ry-