Skip to content

Include type checker versions in long description #96

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

Merged
merged 5 commits into from
Jun 13, 2023

Conversation

srittau
Copy link
Member

@srittau srittau commented Jun 12, 2023

@srittau srittau marked this pull request as ready for review June 12, 2023 10:50
Copy link
Contributor

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Generally I like the idea, but I have one comment and I think it may be worth writing few unit tests for _read_requirements().

line = line.split(";")[0] # strip extras
if not line.strip(): # skip empty lines
continue
if "==" in line:
Copy link
Contributor

Choose a reason for hiding this comment

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

What if at some point in future someone will (accidentally) write e.g. mypy>=1.5.1?

Copy link
Contributor

@AlexWaygood AlexWaygood Jun 12, 2023

Choose a reason for hiding this comment

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

Stub-uploader already has packaging as a requirement, so we could use the packaging.requirements.Requirement class to parse each line (once it's been stripped of comments), rather than doing our own parsing. That would simplify this code and also be more robust/better tested.

Copy link
Member Author

@srittau srittau Jun 12, 2023

Choose a reason for hiding this comment

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

Edit: The build will fail. I see that as a feature. Using a non-pinned version in typeshed would make tests non-reproducible. Although maybe we could reorganize requirements-tests.txt a bit and add a comment to that effect?

Edit: I will make the fails explicit tomorrow + unit tests.

Copy link
Contributor

@AlexWaygood AlexWaygood Jun 12, 2023

Choose a reason for hiding this comment

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

I agree that most of our test dependencies (and definitely our type-checker dependencies) in typeshed should be pinned. But if we want to test that, I feel like we should have a dedicated test (or lint) for it, rather than having some unrelated code in stub-uploader inexplicably fail when that rule is broken.

Copy link
Contributor

Choose a reason for hiding this comment

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

(We run stub_uploader tests in typeshed, so if you have an integration test that makes sure this works, we should get failures at typeshed PR time)

@srittau
Copy link
Member Author

srittau commented Jun 12, 2023

Generally I like the idea, but I have one comment and I think it may be worth writing few unit tests for _read_requirements().

Good idea, I will do so tomorrow.

@srittau
Copy link
Member Author

srittau commented Jun 12, 2023

typeshed is prepared now. I will add tests and switch to use packaging tomorrow.

@srittau
Copy link
Member Author

srittau commented Jun 13, 2023

Also, commit should probably become part of TypeshedData, but I will send a separate PR after this is merged to keep the changes minimal.

Copy link
Contributor

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

This looks great to me, and I think will be really useful. Thanks @srittau!

@srittau srittau merged commit ba911c7 into main Jun 13, 2023
@srittau srittau deleted the typechecker-versions branch June 13, 2023 16:19
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.

4 participants