scrapinghub / price-parser

Extract price amount and currency symbol from a raw text string
BSD 3-Clause "New" or "Revised" License
316 stars 50 forks source link

MyPy error thrown when importing using from #56

Open wheelereng opened 2 years ago

wheelereng commented 2 years ago

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 commented 2 years ago

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

lopuhin commented 2 years ago

@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 commented 2 years ago

@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)