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

MyPy error thrown when importing using from #56

Open
wheelereng opened this issue Nov 9, 2022 · 3 comments
Open

MyPy error thrown when importing using from #56

wheelereng opened this issue Nov 9, 2022 · 3 comments

Comments

@wheelereng
Copy link

When type checking with MyPy, an error is thrown when using from price_parser import parse_price, namely:

Module "price_parser" does not explicitly export attribute "parse_price"; implicit reexport disabled

I suspect this is due to the entities not being defined in __all__

@wheelereng
Copy link
Author

Will raise a PR at a later date, just noting here for visibility.

@lopuhin
Copy link
Member

lopuhin commented Nov 10, 2022

@wheelereng I wonder if you might be running a different mypy version or options, as the mypy build passes on CI: https://github.com/scrapinghub/price-parser/actions/runs/3409870069/jobs/5672160520 (this build is from a PR but it has no diff with master except for adding CI config). tox -e mypy should reproduce what we run on CI.

@matthewhughes934
Copy link

matthewhughes934 commented Nov 10, 2022

@wheelereng I wonder if you might be running a different mypy version or options, as the mypy build passes on CI: https://github.com/scrapinghub/price-parser/actions/runs/3409870069/jobs/5672160520 (this build is from a PR but it has no diff with master except for adding CI config). tox -e mypy should reproduce what we run on CI.

This is an issue when mypy is run with --no-explicit-reexport, which is off by default (it is enabled with strict) https://mypy.readthedocs.io/en/stable/config_file.html#confval-implicit_reexport

$ cat t.py
from price_parser import Price
$ mypy --no-implicit-reexport t.py
t.py:1: error: Module "price_parser" does not explicitly export attribute "Price"  [attr-defined]
Found 1 error in 1 file (checked 1 source file)

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

No branches or pull requests

3 participants