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 files #269

Closed
wants to merge 1 commit into from
Closed

Add py.typed files #269

wants to merge 1 commit into from

Conversation

NiklasRosenstein
Copy link
Contributor

Fixes python-poetry/poetry#5099

This PR adds a py.typed file to mark the poetry-core source code as containing type hints.

Having poetry-core typed allows Poetry plugins to be more thoroughly type checked with Mypy.

@sonarcloud
Copy link

sonarcloud bot commented Jan 24, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@finswimmer
Copy link
Member

Hello @NiklasRosenstein,

thanks a lot for your contribution 👍

We would like to wait for this until we thoroughly type checked poetry-core itself with mypy to give you the best experience with it. 😃

fin swimmer

@NiklasRosenstein
Copy link
Contributor Author

NiklasRosenstein commented Jan 25, 2022

Hey @finswimmer,

Don't you think that having some wrong types is better than no types to check against?

It also opens up the opportunity for consumers of poetry-core to detect typing issues; see #270

@radoering
Copy link
Member

We would like to wait for this until we thoroughly type checked poetry-core itself with mypy to give you the best experience with it. 😃

Maybe, we should rethink this? It could even help avoiding bugs in poetry. See python-poetry/poetry#5485 (comment)

I assume it does more good than evil.

@dimbleby
Copy link
Contributor

I think on the whole this would be better in than not in

  • we probably have made progress on the typechecking in this project since this MR was originally raised
  • most remaining errors are probably mostly on internal methods and won't harm users of this library
  • but anyway surely the only user of this library that counts is poetry itself, and if poetry would find it helpful to have typing here then that's the main thing

And if there are still mistakes then having a py.typed will encourage putting them right.

We could be still further ahead on the typechecking if the MRs that helped to progress this would be merged. python-poetry/poetry#5017 asks for community help, but poetry is slow to accept that help when it arrives. I added a list of open MRs that I know about at python-poetry/poetry#5017 (comment).

@radoering
Copy link
Member

I suppose this can be closed because py.typed has already sneaked in via #331. 😉

@radoering radoering closed this Apr 30, 2022
@dimbleby
Copy link
Contributor

dimbleby commented May 3, 2022

py.typed has already sneaked in via #331.

I just noticed that myself! This was an accident, I'd been trying the effect of adding this and... well, I guess an empty file is an easy thing to miss in a diff.

Anyway, I came here to say that it had gone in accidentally but I reckon that it should stay anyway, happy to see that this was already the thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants