molstar / mol-view-spec

https://molstar.org/mol-view-spec/
MIT License
17 stars 4 forks source link

Missing types #17

Open midlik opened 10 months ago

midlik commented 10 months ago

Hi, I'm creating example for using the molviewspec Python package. All works fine and I'm getting correct code suggestions and types in IDE. But when I run mypy, it says types for molviewspec are missing.

@JonStargaryen could you have a look at this?

$ cat example.py 
import molviewspec as mvs
builder = mvs.create_builder()

$ python -m mypy example.py 
example.py:1: error: Skipping analyzing "molviewspec": module is installed, but missing library stubs or py.typed marker  [import-untyped]
example.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

$ python -m pip freeze
molviewspec==0.1.3
mypy==1.8.0
mypy-extensions==1.0.0
pydantic==1.10.14
typing_extensions==4.9.0
sbittrich commented 9 months ago

By no means a fix but python -m mypy --ignore-missing-imports example.py deals with this.

From what I saw, py.typed should be part of the project if it's typed. It can be empty if types are part of the codebase, as is the case here. Anyway, this isn't good enough to get rid of the error but certainly good to have regardless. Might do some more digging if I find the time. Not sure how big of an issue this is. It happens for dependencies as well, which is the reason for ignore_missing_imports = True in our mypy.ini.