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 in accordance with PEP-561 #2738

Merged
merged 5 commits into from Aug 8, 2023
Merged

Conversation

zmievsa
Copy link
Contributor

@zmievsa zmievsa commented May 3, 2023

Pull Request check-list

  • Does $ tox pass with this change (including linting)?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

Description of change

Add py.typed in accordance with PEP-561. Otherwise type checkers might ignore type hints from this package (particularly old versions of pyright)

@chayim
Copy link
Contributor

chayim commented May 3, 2023

@Ovsyanka83 thanks kindly! But.. the library isn't fully typed at this time. Want to help out by contributing type hints?

@chayim chayim added maintenance Maintenance (CI, Releases, etc) waiting-for-response labels May 3, 2023
@zmievsa
Copy link
Contributor Author

zmievsa commented May 3, 2023

Would love to. I think, the PEP allows us to specify that the typing is partial

@chayim
Copy link
Contributor

chayim commented May 3, 2023

Amazing, didn't know about the partial bit. Any idea how typeshed handles that? Those types are incorrect - but if they won't absorb (even after the 6 month cycle) it's... perhaps less valuable. WDYT?

@codecov-commenter
Copy link

codecov-commenter commented May 3, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02 ⚠️

Comparison is base (2732a85) 90.66% compared to head (7d123e1) 90.64%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2738      +/-   ##
==========================================
- Coverage   90.66%   90.64%   -0.02%     
==========================================
  Files         126      126              
  Lines       32229    32229              
==========================================
- Hits        29221    29215       -6     
- Misses       3008     3014       +6     
Impacted Files Coverage Δ
setup.py 0.00% <ø> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zmievsa
Copy link
Contributor Author

zmievsa commented May 3, 2023

I will try to leave my full reply and research into that next week or, in the worst case, by the end of the month.

@akx
Copy link
Contributor

akx commented May 9, 2023

@chayim We added types to Babel in the last release, see python-babel/babel#975 and python/typeshed#9832 for relevant discussion.

@chayim
Copy link
Contributor

chayim commented May 10, 2023

Thanks @akx any idea how partially typed works? typeshed is wrong in all sorts of places for redis-py... The library is only partially typed.. hence the Q

@akx
Copy link
Contributor

akx commented May 10, 2023

@chayim I'd assume that anything not explicitly typed will remain any-typed, just as if it hadn't been typed at all. But you'd probably not want to mix and match typeshed types with the native ones.

@chayim
Copy link
Contributor

chayim commented Jun 8, 2023

I have the same assumption.. hence my worry. Maybe we should get this into 5 instead - along with more typings.

@chayim chayim merged commit a532f89 into redis:master Aug 8, 2023
54 checks passed
@JelleZijlstra
Copy link
Contributor

typeshed is wrong in all sorts of places for redis-py

@chayim If you have concrete examples of this, please let the typeshed project know and we'll try to fix it.

Great to see redis-py adding py.typed though!

@Avasam
Copy link
Contributor

Avasam commented Sep 12, 2023

(not a typeshed maintainer, just a contributor), FWIW, #2730 has been blocking me from fixing a handful of redis typing issues. And furthermore enabling more tools and checks in typeshed that ensures proper typing.

Concerning incomplete typing in both the base library (here) and typeshed, refer to my comment there: python/typeshed#10592 (comment) I fully support type definitions moving fully into Redis itself. But if it can't be done quickly or completely, Typeshed should be able to provide explicitly partial stubs and gradually remove modules as they are type-completed in Redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc) waiting-for-response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants