Skip to content

Commit b092a73

Browse files
authored
add py.typed file per PEP561 (#846)
The (present-but-empty) `py.typed` file indicates to mypy (and presumably other type checkers) that this module supports type annotations. The problem: I have [a repo](https://github.com/viam-modules/re-id-object-tracking) which imports this SDK, but running `mypy main.py` on it gives a bunch of errors like this: ``` src/config/attribute.py:3: error: Skipping analyzing "viam.proto.app.robot": module is installed, but missing library stubs or py.typed marker [import-untyped] src/config/config.py:1: error: Skipping analyzing "viam.proto.app.robot": module is installed, but missing library stubs or py.typed marker [import-untyped] ``` These errors occur despite all the type annotations in the SDK. The solution: in my virtual environment, I ran `touch venv/lib/python3.12/site-packages/viam/py.typed`, and all those errors went away. This works because of [PEP561](https://peps.python.org/pep-0561/), which says "Package maintainers who wish to support type checking of their code MUST add a marker file named `py.typed` to their package" This PR hopefully does the same thing to the official version. However, I'm unsure how to test this out.
1 parent 5b4d8e2 commit b092a73

File tree

1 file changed

+0
-0
lines changed

1 file changed

+0
-0
lines changed

src/viam/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)