KEMBAR78
Recognise both `attrs` and `attr` package names in the plugin by TeamSpen210 · Pull Request #12469 · python/mypy · GitHub
Skip to content

Conversation

TeamSpen210
Copy link
Contributor

Description

As of version 21.3.0, the attrs project provides its API under both the old attr and new attrs package names. This PR adds the new names to the various constants so their special behaviour is properly recognised.

Test Plan

I added additional tests to check for the special behaviour of each new function. Since they have identical behaviour, I don't think duplicating all the tests for the packages is necessary. The stubs are duplicated though to ensure the plugin detects both names and doesn't just rely on object identity via import. Currently the implementation defines in attr and imports in attrs, but this future-proofs in case that changes.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@jhance jhance left a comment

Choose a reason for hiding this comment

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

Thanks, it mostly looks good, just style bits.

[builtins fixtures/attr.pyi]

[case testAttrsOptionalConverterNewPackage]
# flags: --strict-optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it not on by default for tests? I tried to check but either nobody else is using this or github search is broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, I just copied it from the test above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah okay.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@jhance jhance merged commit 433544b into python:master Mar 29, 2022
@TeamSpen210 TeamSpen210 deleted the attrs-new-package branch April 4, 2022 00:29
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.

2 participants