jaraco / pip-run

pip-run - dynamic dependency loader for Python
MIT License
135 stars 20 forks source link

Module "jaraco" has no attribute "env" #79

Closed jaraco closed 1 year ago

jaraco commented 1 year ago

mypy tests have started failing with:

_______________________________________________________________ pip_run/commands.py _______________________________________________________________
7: error: Module "jaraco" has no attribute "env"  [attr-defined]
jaraco commented 1 year ago

It's true that the jaraco module doesn't have an attribute env. That is, unless you've installed jaraco.env, in which case, there it is.

jaraco commented 1 year ago

And it's present in the test environment where the error occurs:

 pip-run main @ ls .tox/py/lib/python3.11/site-packages/jaraco
__pycache__ context.py  env.py      functools   path.py     test        text
jaraco commented 1 year ago

According to this answer, it's a known bug in mypy since 0.700, but that doesn't explain why tests passed three weeks ago.

jaraco commented 1 year ago

I don't see anything relevant in the changelog (after a brief scan and search for 'import').

jaraco commented 1 year ago

Downgrading to mypy 1.4.1 bypasses the failure.

I tried downgrading to 1.4.1 and I thought the problem was fixed, but I'd forgotten I'd put another workaround in place (re-wording the import).

Maybe the change is due to the introduction of py.typed to jaraco.functools.

jaraco commented 1 year ago

Indeed, downgrading jaraco.functools to <3.9 works around the issue, implicating https://github.com/jaraco/jaraco.functools/pull/22.