I want to remove tests files and tests-related files from my distribution, both sdist
and bdist
.
The package structure is:
foo
|_ __init__.py
|_ conftest.py
|_ foofoo.py
|_ utils
|_ __init__.py
|_ tests
|_ __init__.py
|_ test_foo_utils.py
|_ foo_utils.py
|_ _tests.py
|_ tests
|_ __init__.py
|_ test_foofoo.py
pyproject.toml
From this structure, I don’t want to distribute the tests
modules, the conftest.py
file and the utils/_tests.py
file.
In pyproject.toml
, I can set the package discovery to:
[tool.setuptools.packages.find]
exclude = ['foo*tests']
include = ['foo*']
which correctly selects all files except the tests
modules. But I don’t find a way to drop the 2 individual .py
files from pyproject.toml
/ setuptools
. Instead, I had to add those 2 lines to MANIFEST.in
:
exclude foo/conftest.py
exclude foo/utils/_tests.py
Is there no way to configure setuptools
in pyproject.toml
to directly drop those 2 files? I’m a bit surprised I still need a MANIFEST.in
for this operation.
Mathieu