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

Add py.typed to enable downstream type usage #163

Merged
merged 2 commits into from
May 31, 2022
Merged

Conversation

gadomski
Copy link
Member

@gadomski gadomski commented May 20, 2022

Related Issue(s):

Description:

Based on the instructions at https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages. Manual checkout of downstream usage:

$ mkvirtualenv test-project >/dev/null 2>&1
$ pip install -U pip pystac-client mypy >/dev/null 2>&1
$ cat foo.py
from pystac_client.client import Client

id = 2
client = Client(id)
$ mypy foo.py
foo.py:1: error: Skipping analyzing "pystac_client.client": module is installed, but missing library stubs or py.typed marker
foo.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)
$ pip uninstall -y pystac-client >/dev/null 2>&1
$ pip install 'git+https://github.com/stac-utils/pystac-client@issues/143-mypy-stubs' >/dev/null 2>&1
$ mypy foo.py
foo.py:4: error: Missing positional argument "description" in call to "Client"
foo.py:4: error: Argument 1 to "Client" has incompatible type "int"; expected "str"
Found 2 errors in 1 file (checked 1 source file)

PR Checklist:

  • Code is formatted
  • Tests pass
  • Changes are added to the CHANGELOG

@gadomski gadomski force-pushed the issues/143-mypy-stubs branch 2 times, most recently from 7993181 to e44eedf Compare May 31, 2022 20:19
@gadomski gadomski merged commit a8142e0 into main May 31, 2022
@gadomski gadomski deleted the issues/143-mypy-stubs branch May 31, 2022 20:24
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 this pull request may close these issues.

Provide stub file for mypy integration
2 participants