Skip to content

Add py.typed #175

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

Closed
wants to merge 1 commit into from
Closed

Add py.typed #175

wants to merge 1 commit into from

Conversation

davetapley
Copy link
Contributor

Better late than never 😁

#111

@ehinman
Copy link
Collaborator

ehinman commented May 7, 2025

Hey there, thanks for your contribution. How would you suggest I test this?

@davetapley
Copy link
Contributor Author

@ehinman if you use and IDE with type checking (or manually run through e.g. MyPy) you'll get the error show on #111, but with this change you won't. More info on #11.

Thanks!

@ehinman
Copy link
Collaborator

ehinman commented May 9, 2025

I am using VSCode and can't seem to recreate the issue - I first pulled down your branch, installed in a new environment, had no problems with the following code (could see type checking, which is what was expected, yay!):

import dataretrieval.wqp as wqp
wqp.get_results()

Screenshot 2025-05-08 at 8 33 10 PM

But then I removed your installation of dataretrieval and just tried pip install dataretrieval and I had the same result (no red error indications or anything).

I am all for following conventions, and I appreciate you adding this in. Just to make sure I'm clear, do we also need to add the following to setup.py (seen in this article)?:

from setuptools import setup

setup(
    package_data={"dataretrieval": ["py.typed"]}
)

@davetapley
Copy link
Contributor Author

Good catch on setup.py, I pushed that ✅

Weird, I thought it might be a Juypter thing, but nope:

Screen Shot 2025-05-09 at 2 58 08 PM

Here's my info, for the record:

VSCode

Version: 1.100.0
Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571
Date: 2025-05-07T12:48:53.763Z (2 days ago)
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin x64 21.6.0

Python extension

Version
2025.6.0
Last Updated
2025-05-08, 12:33:10

I even tried a basic test.py with same import as your example, and get:

$ pyright test.py 
/workspaces/ng/test.py
  /workspaces/ng/test.py:1:8 - error: Stub file not found for "dataretrieval.wqp" (reportMissingTypeStubs)
1 error, 0 warnings, 0 informations 

$ pyright --version
pyright 1.1.400

@thodson-usgs
Copy link
Collaborator

I'm wasn't able to reproduce the error using mypy. Would you mind pasting your 'test.py' in the thread?

@davetapley
Copy link
Contributor Author

@thodson-usgs it was literally just:

import dataretrieval.wqp as wqp

wqp.get_results()

But now I cannot reproduce 😑

I did recently just switch to using uv and reinstalled everything, so perhaps I was just on an older version. Sorry for the trouble!

@davetapley davetapley closed this May 20, 2025
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.

None yet

3 participants