-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
new checkAdding a new checkAdding a new checkunder considerationDev has not yet decided whether or how to implementDev has not yet decided whether or how to implement
Description
I put a wheel at https://test.pypi.org/project/issue40/#files which build was happy to build, twine was happy to push, and check-wheel-contents is happy with:
$ pip download issue40 --index-url=https://test.pypi.org/simple
...
$ check-wheel-contents issue40-0.0.1-py3-none-any.whl
issue40-0.0.1-py3-none-any.whl: OK
Pip is happy to install it and create its console script entrypoint
$ pip install ./issue40-0.0.1-py3-none-any.whl
Processing ./issue40-0.0.1-py3-none-any.whl
Installing collected packages: issue40
Successfully installed issue40-0.0.1
$ cat .venv/lib/python3.12/site-packages/issue40-0.0.1.dist-info/entry_points.txt
[console_scripts]
hello = mypkg:hello_world
$ cat .venv/lib/python3.12/site-packages/mypkg/__init__.py
def helloworld():
print("hello, world!!")
But it has a problem - typo in the entrypoint, or maybe a function was renamed and forgetting to also rename the metadata in the toml at the same time:
$ hello
Traceback (most recent call last):
File "/private/tmp/i/.venv/bin/hello", line 5, in <module>
from mypkg import hello_world
ImportError: cannot import name 'hello_world' from 'mypkg' (/private/tmp/i/.venv/lib/python3.12/site-packages/mypkg/__init__.py). Did you mean: 'helloworld'?
Do you think this is something in scope for check-wheel-contents? Some warning or info if they don't appear to resolve somewhere sensible within the package? It could use some static analysis (ast) so that it doesn't need to import any code to look for that.
Here is a source tree to create this wheel
.
├── mypkg
│ └── __init__.py
└── pyproject.toml
mypkg/__init__.py
def helloworld():
print("hello, world!!")
pyproject.toml
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "issue40"
version = "0.0.1"
[tool.setuptools]
packages = ["mypkg"]
[project.scripts]
hello = "mypkg:hello_world"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
new checkAdding a new checkAdding a new checkunder considerationDev has not yet decided whether or how to implementDev has not yet decided whether or how to implement