Skip to content
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

Add __path__ to package __init__ #9454

Merged
merged 8 commits into from
Aug 4, 2021
Merged

Conversation

hauntsaninja
Copy link
Collaborator

Resolves #1422

I see there's a small graveyard of attempted fixes to this issue. Hopefully the same fate does not befall this PR.

@hauntsaninja
Copy link
Collaborator Author

I wasn't thrilled about the 200+ failed tests, so I added list to lib-stub's builtins. I guess I'm about to find out if that's acceptable :-)

@hauntsaninja hauntsaninja marked this pull request as ready for review September 18, 2020 18:41
@@ -12,14 +12,6 @@ import m
m.x # E: "object" has no attribute "x"
[file m.py]

[case testListMissingFromStubs]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete this test? The behavior it's testing (error messages tailored to bad fixtures) seems useful.

Copy link
Collaborator Author

@hauntsaninja hauntsaninja Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quickest way to resolve the many test failures was to add list to the builtin stubs (I expect this might be controversial), which of course broke this test.
We have tests for tailored error messages for several other specific fixtures, so I figured this wouldn't be the worst test to remove, especially since I anticipate pushback on adding list to builtin stubs.

hauntsaninja added 4 commits October 5, 2020 22:05
This gives us better errors for fixtures stuff and helps with Python 2
@mfarrugi
Copy link

mfarrugi commented Dec 9, 2020

@JelleZijlstra what else needs to be done here? This fixes the first mypy bug many users will run into.

@JelleZijlstra
Copy link
Member

I'd prefer for @JukkaL to review it.

@JukkaL
Copy link
Collaborator

JukkaL commented Dec 11, 2020

The build seems to be stuck. If you can make this up to date with master so that there's a passing build, I'm happy to review this.

@hauntsaninja
Copy link
Collaborator Author

Unstuck Travis, and all is green!

@pearceeverydaylabs
Copy link

@JukkaL @hauntsaninja looks like we were really close on this! Any chance we revisit and get it merged? 🤞

@pearceeverydaylabs
Copy link

@JukkaL @hauntsaninja bump for approval :)

@github-actions

This comment has been minimized.

hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this pull request Apr 15, 2021
Yes, technically it returns whatever its first argument is if it isn't
a list.

Doing this because python/mypy#9454 (comment)
@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member

Python 3.5 CI failed with some SSL error (as seems to happen half the time now). I restarted it.

hauntsaninja added a commit to python/typeshed that referenced this pull request Apr 15, 2021
Yes, technically it returns whatever its first argument is if it isn't
a list.

Doing this because python/mypy#9454 (comment)
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2021

Diff from mypy_primer, showing the effect of this PR on open source code:

porcupine (https://github.com/Akuli/porcupine.git)
+ porcupine/images/__init__.py:9: error: Name "__path__" already defined (possibly by an import)  [no-redef]
+ porcupine/plugins/__init__.py:13: error: Name "__path__" already defined (possibly by an import)  [no-redef]

poetry (https://github.com/python-poetry/poetry.git)
- poetry/__init__.py:4: error: Cannot determine type of "__path__"
+ poetry/mixology/failure.py:144: error: Item "RootCause" of "Union[RootCause, NoVersionsCause, DependencyCause, ConflictCause, PythonCause, PlatformCause, PackageNotFoundCause]" has no attribute "conflict"

edgedb (https://github.com/edgedb/edgedb.git)
+ edb/schema/std.py:41: error: unused "type: ignore" comment
+ edb/schema/std.py:42: error: unused "type: ignore" comment
+ edb/schema/std.py:43: error: unused "type: ignore" comment
+ edb/schema/std.py:44: error: unused "type: ignore" comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support __path__ in packages
5 participants