question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

notebook shadow module causing mypy errors

See original GitHub issue

When a package contains both notebook and a module with the same exact name, it seems like nbqa-mypy gets confused and the notebook shadows the module causing mypy errors.

Example structure:

pipelines/foo
├── __init__.py
├── bar.py
├── bar.ipynb

My config:

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 0.5.9
    hooks:
      - id: nbqa-mypy
        args: ["--nbqa-ignore-cells=%%R,%%bash", "--strict", "--show-error-codes", "--pretty", "--show-error-context"]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ravwojdylacommented, Apr 19, 2021

👋 @MarcoGorelli, yep, looks like 0.7.0 fixed it, thank you!

1reaction
MarcoGorellicommented, Apr 4, 2021

@ravwojdyla if you update to 0.6.0, I’d like to think this is fixed - please do let us know if you encounter any other issues (or if this one is still present), and thank you so much for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fail fast if special module like typing not from typeshed #1876
mypy generally crashes with an internal error if it winds up trying to handle a file named typing.py , apparently due to confusion...
Read more >
Common issues and solutions - mypy 0.991 documentation
There are several common reasons why obviously wrong code is not flagged as an error. The function containing the error is not annotated....
Read more >
Installing mypy leads to "shadows library module"-error
Now if I execute mypy I get an error that '"typing_extensions.py" shadows library module "typing_extensions"': mypy --namespace-packages ...
Read more >
AttributeError: module 'X' has no attribute 'Y' in Python
Here is an example of how the error is caused when an imported module is shadowed by a local file with the same...
Read more >
mypy(1) — mypy — Debian testing
Mypy is a static type checker for Python 3 and Python 2.7. If you sprinkle your code with type annotations, mypy can type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found