[BUG] Build succeeds when no packages are found by find_packages
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
setuptools==60.1.0
Python version
3.9
OS
Manjaro Linux
Additional environment information
No response
Description
Incorrectly configuring project that uses packages = find: leads to no packages being found. However build still succeeds without any warnings or errors and generates wheel without any code.
Leaving packages empty also works but I don't know if it is intentional or not. On the other hand when using packages = find: I expect something to be found so I consider this a bug.
Expected behavior
A warning or an error during build
How to Reproduce
- Create project with
src-structure
myproject
- pyproject.toml
- setup.cfg
- src
- - mypackage
- - - __init__.py
- - - app.py
- Edit
setup.cfgto contain:
[metadata]
name = myproject
version = 1.0.0
[options]
packages = find:
package_dir =
= src
;[options.packages.find]
;where = src ; leave this commented so no packages are found
- Run build
- Check that no packages are in the generated wheel
Output
$ python -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools, wheel)
* Getting dependencies for sdist...
running egg_info
writing manifest file 'src/myproject.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing manifest file 'src/myproject.egg-info/SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md
running check
warning: check: missing required meta-data: url
warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) should be supplied
creating myproject-1.0.0
creating myproject-1.0.0/src
creating myproject-1.0.0/src/myproject.egg-info
copying pyproject.toml -> myproject-1.0.0
copying setup.cfg -> myproject-1.0.0
copying src/myproject.egg-info/PKG-INFO -> myproject-1.0.0/src/myproject.egg-info
copying src/myproject.egg-info/SOURCES.txt -> myproject-1.0.0/src/myproject.egg-info
copying src/myproject.egg-info/dependency_links.txt -> myproject-1.0.0/src/myproject.egg-info
copying src/myproject.egg-info/top_level.txt -> myproject-1.0.0/src/myproject.egg-info
Creating tar archive
removing 'myproject-1.0.0' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools, wheel)
* Getting dependencies for wheel...
running egg_info
writing manifest file 'src/myproject.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
running build
running install
running install_egg_info
running egg_info
writing manifest file 'src/myproject.egg-info/SOURCES.txt'
Copying src/myproject.egg-info to build/bdist.linux-x86_64/wheel/myproject-1.0.0-py3.9.egg-info
running install_scripts
Successfully built myproject-1.0.0.tar.gz and myproject-1.0.0-py3-none-any.whl
$ # check wheel content
$ unzip dist/myproject-1.0.0-py3-none-any.whl
Archive: dist/myproject-1.0.0-py3-none-any.whl
inflating: myproject-1.0.0.dist-info/METADATA
inflating: myproject-1.0.0.dist-info/WHEEL
inflating: myproject-1.0.0.dist-info/top_level.txt
inflating: myproject-1.0.0.dist-info/RECORD
Code of Conduct
- I agree to follow the PSF Code of Conduct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the setup.cfg package-discovery configuration using packages = find: and the commented [options.packages.find] section, then reproduce the behavior with python -m build. Trace how setuptools handles an empty package result and verify the completed behavior by inspecting the generated wheel for a warning or error and the expected package contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100