Skip to content

import annotations from __future__ and update annotations#78

Merged
Zac-HD merged 1 commit intopython-trio:mainfrom
jakkdl:future_annotations
Dec 7, 2022
Merged

import annotations from __future__ and update annotations#78
Zac-HD merged 1 commit intopython-trio:mainfrom
jakkdl:future_annotations

Conversation

@jakkdl
Copy link
Member

@jakkdl jakkdl commented Dec 7, 2022

Realized this is a thing ... why haven't we used this all along?? Managing typing imports have been a bit of a pain.

Also shed refactors all the annotations, so only manual step was adding the import at the top of the files 💯
(and manually running shed against the .pyi files since new version hasn't been released)

I kinda want one of the checkers we use to suggest importing annotations from future whenever it encounters importing built-ins from typing

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Ah, I've habitually avoided from __future__ import annotations because it breaks runtime introspection for (e.g.) Hypothesis, Pydantic, and Typeguard, and at work we're on 3.10 anyway. However runtime introspection is not really a relevant concern for flake8-trio, so let's do it!

(happily PEP-649 will be the real future, so this will work itself out eventually)

@Zac-HD Zac-HD merged commit 7863b91 into python-trio:main Dec 7, 2022
@jakkdl
Copy link
Member Author

jakkdl commented Dec 8, 2022

Ah, I figured there would be some kind of reason it's not used everywhere - makes sense.

ooh, fancy! Looking forward to doing from __future__ import co_annotations instead 😄

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