Skip to content

Add type annotations #340

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 3 commits into from
Jan 11, 2022
Merged

Add type annotations #340

merged 3 commits into from
Jan 11, 2022

Conversation

bluetech
Copy link
Member

This adds type annotations to all pluggy code. This is a respin of #225 but now using Python 3 syntax.

The type annotations are not published, it will require some work for it to make sense, cleaning up the interface and imports and such. But I think internal type annotations are still useful for understand the code (I always have to relearn how stuff relate to each other when looking at pluggy) and as a linter.

In the meantime @RonnyPfannschmidt created #326. I think this PR is a better starting point because it almost doesn't change the code itself besides adding the types. Ronny's changes can be added on top maybe.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

Love the approach,

I added types with the goal of mypyc speedup experiments

Those failed

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Great work, thanks @bluetech!

[tool.mypy]
mypy_path = "src"
check_untyped_defs = true
# disallow_any_expr = true
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a comment explaining why this option is commented out? If not remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment

@nicoddemus
Copy link
Member

Took the liberty of committing an update to coverage configuration to ignore typing-related code (c5d5786).

@bluetech
Copy link
Member Author

Thanks for the reviews! I think this is good to go.

@bluetech bluetech merged commit 0e7970a into pytest-dev:main Jan 11, 2022
@bluetech bluetech deleted the type-annotations branch January 14, 2022 11:38
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.

3 participants