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 support for packaging type stubs in pure Rust project layout #567

Merged
merged 1 commit into from
Jun 20, 2021

Conversation

messense
Copy link
Member

Closes #553

@ravenexp
Copy link
Contributor

PEP 561 requires py.typed marker file to be added to packages containing .pyi stubs:

https://www.python.org/dev/peps/pep-0561/#packaging-type-information

@messense messense force-pushed the pure-rust-type-stub branch from 229e65f to 691b5da Compare June 14, 2021 12:46
@messense
Copy link
Member Author

PEP 561 requires py.typed marker file to be added to packages containing .pyi stubs:

https://www.python.org/dev/peps/pep-0561/#packaging-type-information

Thanks! Totally forgot about that...

@ravenexp
Copy link
Contributor

I've tried to build my Rust-only extension using this patch, and the embedded type information stub was discovered by both mypy and PyCharm. Everything works as expected.

Maybe an info message for the user could be added, signalling that the type information stub was discovered and included in the distribution. Currently, when I add a magically-named file to the project root directory, I can only hope that I did everything correctly, and there is no way to verify the result except for manually inspecting the built wheel contents.

@messense
Copy link
Member Author

Maybe an info message for the user could be added, signalling that the type information stub was discovered and included in the distribution. Currently, when I add a magically-named file to the project root directory, I can only hope that I did everything correctly, and there is no way to verify the result except for manually inspecting the built wheel contents.

Good idea, added.

🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.6
🐍 Not using a specific python interpreter (With abi3, an interpreter is only required on windows)
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
📖 Found type stub file at pyo3_pure.pyi
📦 Built wheel for abi3 Python ≥ 3.6 to dist/pyo3_pure-2.1.2-cp36-abi3-macosx_11_0_arm64.whl

@messense messense requested a review from konstin June 16, 2021 05:27
@messense messense force-pushed the pure-rust-type-stub branch 2 times, most recently from 803ab2f to efda87c Compare June 18, 2021 00:41
@messense messense force-pushed the pure-rust-type-stub branch from efda87c to 8442d37 Compare June 20, 2021 03:04
@messense messense merged commit de1f389 into PyO3:main Jun 20, 2021
@messense messense deleted the pure-rust-type-stub branch June 20, 2021 05:30
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.

2 participants