Open
Description
setuptools version
62.1.0
Python version
Python 3.10.4 (main, Mar 30 2022, 23:50:39) [GCC 10.2.1 20210110]
OS
Tested in Alpine Linux 3.14, Debian bullseye and Ubuntu 20.04.4 LTS
Additional environment information
Python 3.10.4 (main, Mar 30 2022, 23:50:39) [GCC 10.2.1 20210110]
Package Version
---------- -------
build 0.7.0
packaging 21.3
pep517 0.12.0
pip 22.0.4
pyparsing 3.0.8
setuptools 62.1.0
tomli 2.0.1
wheel 0.37.1
Description
For some reason, when include_package_data = True
, subpackages excluded via options.packages.find.exclude
are still added to the wheel.
Expected behavior
When listed via options.packages.find.exclude
a subpackage should not be added to the wheel.
How to Reproduce
> docker run --rm -it python:3.10-bullseye /bin/bash
mkdir /tmp/mypkg
cd /tmp/mypkg
mkdir -p mypkg/tests
touch mypkg/__init__.py
touch mypkg/resource.txt
touch mypkg/tests/test_mypkg.py
touch mypkg/tests/test_file.txt
cat <<EOS > pyproject.toml
[build-system]
requires = ['setuptools']
build-backend = 'setuptools.build_meta'
EOS
cat <<EOS > setup.cfg
[metadata]
name = mypkg
version = 42
[options]
include_package_data = True
packages = find:
[options.packages.find]
exclude = *.tests*
EOS
cat <<EOS > MANIFEST.in
global-include *.py *.txt
global-exclude *.py[cod]
prune dist
prune build
EOS
python -m pip install -U pip build setuptools wheel
python -VV
python -m pip list
rm -rf dist build mypkg.egg-info
python -m build --no-isolation
# `--no-isolation` is used to guarantee we have control over the
# versions of the build dependencies
unzip -l dist/*.whl
Output
Length Date Time Name
--------- ---------- ----- ----
0 2022-04-11 17:49 mypkg/__init__.py
0 2022-04-11 17:49 mypkg/resource.txt
0 2022-04-11 17:49 mypkg/tests/__init__.py
0 2022-04-11 17:49 mypkg/tests/test_file.txt
0 2022-04-11 17:49 mypkg/tests/test_mypkg.py
108 2022-04-11 17:49 mypkg-42.dist-info/METADATA
92 2022-04-11 17:49 mypkg-42.dist-info/WHEEL
6 2022-04-11 17:49 mypkg-42.dist-info/top_level.txt
654 2022-04-11 17:49 mypkg-42.dist-info/RECORD
--------- -------
860 9 files
The expected output should not include:
- mypkg/tests/__init__.py
- mypkg/tests/test_file.txt
- mypkg/tests/test_mypkg.py
[Related: https://github.com//issues/3340]