I’ve tested with
[build-system]
requires = [
"wheel",
"setuptools @ git+https://github.com/pypa/setuptools@experimental/support-pyproject"
]
build-backend = "setuptools.build_meta"
[project]
name = "pkg_dir_name"
# and all other required
dynamic = ['version']
[tool.setuptools]
package-dir = {"" = "pkg_dir_name"}
include-package-data = true
[tool.setuptools.packages]
find.where = ["pkg_dir_name"]
find.exclude = ["tests", "scripts", "utils"]
[tool.setuptools.dynamic]
version = {attr = "__version__"}
It completed first step OK
* Building sdist...
...
Creating tar archive
but failed on next
* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools @ git+https://github.com/pypa/setuptools@experimental/support-pyproject, wheel)
* Getting dependencies for wheel...
...
Traceback (most recent call last):
File "/tmp/build-env-r5a4apod/lib/python3.9/site-packages/setuptools/config/expand.py", line 79, in __getattr__
return next(ast.literal_eval(value) for value in matching_values)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/build-env-r5a4apod/lib/python3.9/site-packages/setuptools/config/expand.py", line 178, in read_attr
return getattr(StaticModule(module_name, spec), attr_name)
File "/tmp/build-env-r5a4apod/lib/python3.9/site-packages/setuptools/config/expand.py", line 81, in __getattr__
raise AttributeError(f"{self.name} has no attribute {attr}") from e
AttributeError: __init__ has no attribute __version__
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
...
File "/tmp/build-env-zde5d6vt/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 253, in _expand_dynamic
return _expand.read_attr(directive["attr"], package_dir, root_dir)
File "/tmp/build-env-zde5d6vt/lib/python3.9/site-packages/setuptools/config/expand.py", line 182, in read_attr
return getattr(module, attr_name)
AttributeError: module '__init__' has no attribute '__version__'
While tree looks more or less:
$ tree -L 1
pkg_dir_name_repository
├── pkg_dir_name
│ ├── submodule
│ ├── __init__.py # contains __version__ = '1.0.0'
│ └── entrypoint.py
├── LICENSE
├── pyproject.toml
├── README.md
├── requirements-dev.txt
├── requirements.txt
├── scripts
├── tests
├── utils
└── venv
If I omit find.where
[tool.setuptools]
package-dir = {"" = "pkg_dir_name"}
include-package-data = true
[tool.setuptools.packages]
# find.where = ["pkg_dir_name"]
find.exclude = ["tests", "scripts", "utils"]
It completes both steps successfully, but also venv and other items are packed, including those “excluded”.