Skip to content

Conversation

@alex
Copy link
Member

@alex alex commented Feb 9, 2021

closes #5796

@reaperhulk reaperhulk merged commit e8ec55c into pyca:master Feb 9, 2021
@alex alex deleted the py-typed branch February 9, 2021 16:34
alex added a commit to alex/cryptography that referenced this pull request Feb 9, 2021
reaperhulk added a commit that referenced this pull request Feb 9, 2021
* fixed a circular import error (due to type hints) (#5800)

fixes #5794
closes #5795

* Added a py.typed so mypy prefers us to typeshed (#5802)

closes #5796

* 3.4.4 changelog + version bump

* Update CHANGELOG.rst

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
@intgr
Copy link
Contributor

intgr commented Feb 11, 2021

Note that this change regresses the precision of type checkers significantly, at least in my use case.

See for example https://github.com/pyca/cryptography/blob/b24d522b05b2220fbcb74363e454c2997a0c7ab7/src/cryptography/x509/extensions.py, there are almost no type hints in this file.

Compare that to the typeshed version https://github.com/python/typeshed/blob/master/stubs/cryptography/cryptography/x509/__init__.pyi

Note that a dozen or so people contributed to the cryptography stubs in typeshed, me included. I think cryptography upstream should be more considerate that this work isn't lost at a whim.

But now that this is done, what are the options going forward? I can only think of

  • (1) revert addition of py.typed in cryptography
  • (2) import hints from typeshed

Unfortunately option (2) seems like significant work and not a short-term solution. I understand that (1) isn't great either. Any other options that I didn't think of?

@reaperhulk
Copy link
Member

@intgr Thanks for pointing out that we missed this! We've started the typing work on that module in #5812 and will get it done ASAP. If there are other areas we've missed please open a new issue so we can track it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants