-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
importing google.cloud.logging causes untyped modules in the namespace to be considered missing #10360
Comments
this is also annoying when |
Still reproducible on current Maybe it will be helpful: mypy check also passes if |
It has helped me. Thank you for your help! |
Summarising the issue (since there are some minor aspects of the original post I can't repro):
That is, other imports from the same namespace package can affect the error code produced by a faulty import (the import from google-cloud-logging is faulty because it's not py.typed). egilewski's workaround works well (because with
|
Refs: python/mypy#10360 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Refs: python/mypy#10360 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Refs: python/mypy#10360 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Refs: python/mypy#10360 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
* chore(deps): upgrade google-cloud-bigquery Remove version constraint and include the new dependencies of numpy and pyarrow. Corrects current broken state where the combination of dependencies prevents resolution. Increases overall image size by ~100MB to include these dependencies Signed-off-by: Mike Fiedler <miketheman@gmail.com> * lint: import Client directly to avoid mypy issue Refs: python/mypy#10360 Signed-off-by: Mike Fiedler <miketheman@gmail.com> * test: update tests to reflect import change Signed-off-by: Mike Fiedler <miketheman@gmail.com> * lint: rename variable, formatting Signed-off-by: Mike Fiedler <miketheman@gmail.com> * Bump pyjwt[crypto] from 2.4.0 to 2.5.0 Bumps [pyjwt[crypto]](https://github.com/jpadilla/pyjwt) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst) - [Commits](jpadilla/pyjwt@2.4.0...2.5.0) --- updated-dependencies: - dependency-name: pyjwt[crypto] dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Mike Fiedler <miketheman@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
* run mypy in CI * more type hint fixing * Update requirements.txt * google.cloud import workaround python/mypy#10360 * Revert "google.cloud import workaround" This reverts commit e03dbc7. * mypy google.cloud workaround python/mypy#12985 * fix regular tests * remove --install-types flag * last mypy fix * type fixes for address_reasons * move email lists creation * update for newly merged changes * Fix regular tests * Changes suggested by @jrobbins * Catch invalid requests * small type hint * Change methods to properly override * revert to previous implementation * revert test * add back original validate request type method * remove unused import and rearrange methods * remove comment string casting; add test back * add ndb ignore * Update test_html_rendering.html * mypy fix * remove merge addition
I'm seeing a very similar problem with an in-house project where I run mypy 1.7.1 over a project for both the source package and the tests, with only the --strict option. It succeeds the first time, then fails the second time with an error like the one described above, on a package namespace. Removing .mypy_cache allows it to succeed. |
Having the exact same issue, any workaround or fix? |
For me, the workaround was to remove the |
so I don't lose it from my duplicate #17210:
|
…0183) python/mypy#10360 (comment) fixes: ```console $ mypy src/sentry/utils/kvstore/bigtable.py src/sentry/analytics/pubsub.py src/sentry/analytics/pubsub.py:8: error: Module "google.cloud" has no attribute "pubsub_v1" [attr-defined] Found 1 error in 1 file (checked 2 source files) ``` <!-- Describe your PR here. -->
Ok I dug into this a bit before a flight. Unfortunately wasn't able to identify the correct fix yet, but I have refreshed myself on how the module finding logic works. The root of the error is that we currently record that the package is |
Bug Report
To Reproduce
with the mypy config:
and the .py file:
Actual Behavior
I get
however if I comment out:
I get
Expected Behavior
I don't expect importing a module in a namespace with stubs to affect other modules in that namespace
(Write what happened.)
Your Environment
mypy.
mypy.ini
(and other config files): see aboveThe text was updated successfully, but these errors were encountered: