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

tox complains about missing library stubs or py.typed.marker #362

Open
Dvergatal opened this issue Jun 20, 2022 · 4 comments · May be fixed by #472
Open

tox complains about missing library stubs or py.typed.marker #362

Dvergatal opened this issue Jun 20, 2022 · 4 comments · May be fixed by #472

Comments

@Dvergatal
Copy link

Dvergatal commented Jun 20, 2022

Like in subject during testing our code which uses pytss I'm getting this errors:

device/tpm.py:5: error: Skipping analyzing "tpm2_pytss.ESAPI": module is installed, but missing library stubs or py.typed marker
device/tpm.py:5: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
device/tpm.py:6: error: Skipping analyzing "tpm2_pytss.utils": module is installed, but missing library stubs or py.typed marker
device/tpm.py:7: error: Skipping analyzing "tpm2_pytss.types": module is installed, but missing library stubs or py.typed marker
device/tpm.py:8: error: Skipping analyzing "tpm2_pytss.constants": module is installed, but missing library stubs or py.typed marker
Found 4 errors in 1 file (checked 49 source files)
ERROR: InvocationError for command /work/.tox/mypy/bin/mypy . --strict (exited with code 1)

I suppose, that as the link suggests we are missing typing support in tpm2-pytss package.

@williamcroberts
Copy link
Member

What is exactly is this? What's tox (looks like a testing framework)? How do I reproduce? Did you build the package or just grab the code, if you don't pip install it you won't generate the bindings.

@Dvergatal
Copy link
Author

Dvergatal commented Jun 21, 2022

Our code uses imports from tpm2_pytss. The tpm2_pytss is installed using this command:

python3 -m pip install tpm2-ptss

with newest version 1.2.0. As you can see in my previous log, there is a hint link missing imports, where you can read about this error. tox uses mypy package for static analysis of our code and due to this test I'm getting these errors.

The command which is in tox.ini looks like that:

commands =
    mypy: mypy . --strict

@williamcroberts
Copy link
Member

So, per the docs:

Mypy will not try inferring the types of any 3rd party libraries you have installed unless they either have declared themselves to be [PEP 561 compliant stub package](https://mypy.readthedocs.io/en/stable/installed_packages.html#installed-packages) (e.g. with a py.typed file) or have registered themselves on [typeshed](https://github.com/python/typeshed), the repository of types for the standard library and some 3rd party libraries.

So we need a py.typed file I think... I need information on how to reproduce.

@Dvergatal
Copy link
Author

Dvergatal commented Jun 22, 2022

Ok I have prepared fully workable docker for you with little code, which only imports from tpm2-pytss. To run and get the errors please run this command:

docker-compose run test

mypy-tpm-test.zip

@williamcroberts williamcroberts linked a pull request Nov 21, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants