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

type checker can't find type info #13

Closed
djmannion opened this issue Sep 25, 2024 · 1 comment
Closed

type checker can't find type info #13

djmannion opened this issue Sep 25, 2024 · 1 comment

Comments

@djmannion
Copy link
Contributor

mypy doesn't seem to be able to be aware of the type information in the package.

Example of creating a new virtual environment and running type checking:

python -m venv venv
source venv/bin/activate
pip install retryhttp mypy
mypy -c 'import retryhttp'

gives:

<string>:1: error: Cannot find implementation or library stub for module named "retryhttp"  [import-not-found]

I think py.typed might need to be inside the retryhttp directory?

Thanks!

@austind
Copy link
Owner

austind commented Sep 25, 2024

When I did this:

pip install mypy
mypy -c 'import retryhttp'

I got this:

(.venv) Austins-MBP:retryhttp austin$ mypy -c 'import retryhttp'
retryhttp/_utils.py:18: error: Library stubs not installed for "requests"  [import-untyped]
retryhttp/_utils.py:18: note: Hint: "python3 -m pip install types-requests"
retryhttp/_utils.py:18: note: (or run "mypy --install-types" to install all missing stub packages)
retryhttp/_utils.py:18: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
retryhttp/_utils.py:104: error: Item "BaseException" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_utils.py:104: error: Item "None" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_utils.py:126: error: Item "BaseException" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_utils.py:126: error: Item "None" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_wait.py:72: error: Item "BaseException" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_wait.py:72: error: Item "None" of "BaseException | None" has no attribute "response"  [union-attr]
retryhttp/_retry.py:114: error: Argument 1 to "append" of "list" has incompatible type "retry_if_network_error"; expected "retry_if_server_error"  [arg-type]
retryhttp/_retry.py:116: error: Argument 1 to "append" of "list" has incompatible type "retry_if_timeout"; expected "retry_if_server_error"  [arg-type]
retryhttp/_retry.py:118: error: Argument 1 to "append" of "list" has incompatible type "retry_if_rate_limited"; expected "retry_if_server_error"  [arg-type]
Found 10 errors in 3 files (checked 1 source file)
(.venv) Austins-MBP:retryhttp austin$ 

I haven't done extensive type checking, but I welcome PRs! :)

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

No branches or pull requests

2 participants