Skip to content

Add py.typed files #269

Closed
NiklasRosenstein wants to merge 1 commit into
masterfrom
unknown repository
Closed

Add py.typed files #269
NiklasRosenstein wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@NiklasRosenstein
Copy link
Copy Markdown
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.

@sonarqubecloud
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

poetry-core missing py.typed

4 participants