-
Notifications
You must be signed in to change notification settings - Fork 15
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 type checking #17
Comments
Hi, appreciate you opening this issue here! I can definitely see about adding this tomorrow. Since this is new to me, would you know how I can test to make sure it works before I publish the change to the package? |
Hey @MylesMor — here's a possible way of testing this kind of thing in a GitHub Actions workflow: jobs:
check-pep561-compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: invoke
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: |
pip install mypy
pip install ./nanoleafapi
mkdir newdir
cd newdir
mypy -c "import nanoleafapi" The job should fail with mypy errors without the py.typed file, but pass if the py.typed file has been properly added (including the packaging changes @alexlukas mentioned above, which are necessary to ensure that the file gets included in the wheel) |
Thanks, appreciate this! Unfortunately was super busy today but will hopefully get around to this tomorrow. |
Friendly bump (got here because the related typeshed PR is still open). |
I was a little too fast and created some stubs for the typeshed project in order to allow for type checking code using this library according to PEP 561 (see here for the pull request). However, I was made aware that most of this library is already typed, so to enable type checking for nanoleafapi, all one has to do is
py.typed
filesetup.py
This would explicitly allow type checking for nanoleafapi, e.g. in VS Code.
The text was updated successfully, but these errors were encountered: