-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespace stub-only packages can't be built with Poetry #4621
Comments
IssueWhen I add scripts to my pyproject.toml for example:
I got an error showing that my main stub-only-package is not a package. Error log: Is it a bug or am I doing something wrong? |
@BrenoJesusFernandes That should probably be its own issue but:
|
I had no idea about the second one and works!! But tell me when we build for example the pkg pandas-stubs the stubs are gonna be installed inside the pandas normally? |
From my understanding it's installed as an entirely separate package and pip and Poetry don't know that |
Thx for the tip I am new in the world of stubs, I was looking into the pandas stubs project but it was really unclear how things work and I was trying to improve the project by bringing poetry to the battle, do you know why poetry use *-stubs to recognize a stub-only package? Is there a PEP talking about it? |
Yeah, should be among the first results if you google "python stub only package" |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
PEP561 was recently updated to clarify how to structure stub-only packages for distributions that use namespace packages: python/peps#2083
To summarize, the namespace packages should not have
py.typed
and__init__.pyi
, these should be further down the directory tree in the actual packages. Poetry doesn't support building stub-only packages with this structure, you end up hitting this exception: https://github.com/python-poetry/poetry-core/blob/master/poetry/core/masonry/utils/package_include.py#L83The reason is that this check is too strict: https://github.com/python-poetry/poetry-core/blob/master/poetry/core/masonry/utils/package_include.py#L49-L54
It expects each file to be either a
py.typed
in the root or a.pyi
, which doesn't hold if you have one or morepy.typed
files further down the tree. Seems like simply removing theel.parent.name == self.package
check would fix this issue, so I'd be happy to do a PR for that (though I'm not sure that it's invalid for stub-only packages to include other file types so the check might still be a bit strict).The text was updated successfully, but these errors were encountered: