Skip to content

Include a py.typed marker file with the Python client#100

Merged
OpsBotPrime merged 1 commit intomasterfrom
py-typed
Apr 28, 2026
Merged

Include a py.typed marker file with the Python client#100
OpsBotPrime merged 1 commit intomasterfrom
py-typed

Conversation

@isomorpheme
Copy link
Copy Markdown
Contributor

@isomorpheme isomorpheme commented Apr 24, 2026

Closes #8. I've checked that the py.typed file is included when building via Nix, and then using reveal_type on ProducerClient.get_submission_status changes mypy reporting

note: Revealed type is "Any"

into

note: Revealed type is "def (submission_id: Any) -> Any | None"

So this doesn't entirely make types available, due to PyO3/pyo3#5137, but it improves the situation.

@isomorpheme isomorpheme requested a review from Qqwy April 24, 2026 13:32
@isomorpheme
Copy link
Copy Markdown
Contributor Author

I've created #101 as a possible followup step.

features = ["pyo3/extension-module"]
python-source = "python"
module-name = "opsqueue.opsqueue_internal"
include = ["**/py.typed"]
Copy link
Copy Markdown
Contributor Author

@isomorpheme isomorpheme Apr 24, 2026

Choose a reason for hiding this comment

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

I don't know how to check if this does what I expect it to; I don't know how to inspect the results of just build-python. Would appreciate pointers!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It didn't per se, but I figured it out: just build-python builds a wheel in /tmp and cleans it up before finishing, so instead I used maturin build which outputs it locally. It turns out that .whl files are secretly just zip archives, so I checked and the py.typed is indeed included. 🎉

@Qqwy
Copy link
Copy Markdown
Contributor

Qqwy commented Apr 28, 2026

Thank you very much for this improvement!

I'll combine it into the next release together with the other open PRs. That way our users don't need to bump multiple times in quick succession.

@OpsBotPrime merge

@OpsBotPrime
Copy link
Copy Markdown
Contributor

Rebased as a79b0d8, waiting for CI …

@OpsBotPrime
Copy link
Copy Markdown
Contributor

CI job 🟡 started.

@OpsBotPrime OpsBotPrime merged commit a79b0d8 into master Apr 28, 2026
7 checks passed
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.

Add py.typed to Python client library

3 participants