ivankorobkov / python-inject

Python dependency injection
Apache License 2.0
694 stars 79 forks source link

Type hints are not compatible with mypy #36

Closed alex-grover closed 5 years ago

alex-grover commented 5 years ago

Hello - I'm running into an issue where running mypy on a project that uses inject gives the following error on every import:

path/to/file.py:1: error: Cannot find module named 'inject'
...

Based on the mypy docs it appears that a py.typed file is necessary for PEP 561 compatibility. I tried adding this file and installing my fork but I wasn't able to get it working in the time I had. I'm not an expert with setuptools by any means so maybe my simple change based on the mypy docs was not correct.

If it matters, I am using Python 3.7.4 and my project is using pipenv. There are no issues with mypy and any other third party libs.

Any help would be appreciated!

cc @andrewborba10, not sure if you are using mypy in your workflow

ivankorobkov commented 5 years ago

Hi!

If I get it right, there should be an empty py.typed file at the root of the repository. If that's all that should be done, then please make a pull-request.

ivankorobkov commented 5 years ago

I have released a new version with your fixes https://pypi.org/project/Inject/3.5.4/