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

Create py.typed #5796

Closed
wants to merge 1 commit into from
Closed

Create py.typed #5796

wants to merge 1 commit into from

Conversation

graingert
Copy link
Contributor

the changelog lists:

cryptography now has PEP 484 type hints on nearly all of of its public APIs. Users can begin using them to type check their code with mypy.

but I'm still falling back to typeshed because this file is missing

@tiran
Copy link
Contributor

tiran commented Feb 9, 2021

You also need to add the file to package data, https://www.python.org/dev/peps/pep-0561/#packaging-type-information

@graingert
Copy link
Contributor Author

You also need to add the file to package data, https://www.python.org/dev/peps/pep-0561/#packaging-type-information

Isn't it already covered with include_package_data ?

@tiran
Copy link
Contributor

tiran commented Feb 9, 2021

You also need to add the file to package data, python.org/dev/peps/pep-0561/#packaging-type-information

Isn't it already covered with include_package_data ?

Is include_package_data=True sufficient? I honestly don't know! Could you please check sdist and wheels?

@tiran
Copy link
Contributor

tiran commented Feb 9, 2021

You definitely have to add it to MANIFEST.in:

flake run-test: commands[2] | check-manifest
lists of files in version control and sdist do not match!
missing from sdist:
  src/cryptography/py.typed
suggested MANIFEST.in rules:
  recursive-include src *.typed

MANIFEST.in Outdated Show resolved Hide resolved
MANIFEST.in Outdated Show resolved Hide resolved
@@ -0,0 +1 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the file have to empty? In the past some zip tools had issues with 0 byte files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

I intended for this file to be 0 bytes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's make this a proper 0-byte file (that's what we use on pyca/bcrypt)

@tiran
Copy link
Contributor

tiran commented Feb 9, 2021

You also need to add the file to package data, python.org/dev/peps/pep-0561/#packaging-type-information

Isn't it already covered with include_package_data ?

Is include_package_data=True sufficient? I honestly don't know! Could you please check sdist and wheels?

Yes, it's sufficient.

$ python3 setup.py bdist_wheel
$ unzip -l dist/cryptography-3.5.dev1-cp39-cp39-linux_x86_64.whl | grep py.typed
        0  02-09-2021 12:36   cryptography/py.typed

alex added a commit to alex/cryptography that referenced this pull request Feb 9, 2021
include py.typed in sdist
reaperhulk pushed a commit that referenced this pull request Feb 9, 2021
@graingert graingert deleted the patch-2 branch February 9, 2021 16:32
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

So should cryptography stubs be removed entirely from typeshed repo?

@alex
Copy link
Member

alex commented Feb 11, 2021 via email

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.

None yet

4 participants