Automatically add future annotations import#58
Conversation
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
|
I'm not sure I know enough about those annotations, but it seems like the current plan is that they'll eventually be deprecated and emit warnings?: https://peps.python.org/pep-0749/#the-future-of-from-future-import-annotations. Would the plan be to remove them when we stop supporting e.g. Python 3.13? |
|
Yeah that would be the time. That doc seems to acknowledge the common use of these as it seems there wouldn't be a deprecation until 3.13 is EoL, or even longer past that based on the community. That's many many years away and more lenient than most deprecations plans.
|
| # Format Python files | ||
| format: | ||
| uv run ruff check --fix . | ||
| uv run ruff check --fix --unsafe-fixes --exit-zero . |
There was a problem hiding this comment.
I forgot to comment on this. I have been using unsafe-fixes for a long time and find it great, zero times has it done a wrong fix. That's probably because I work with well behaved code without weird side effects, but I think it applies here too. In the off chance it does do something wrong, manually fixing it would be relatively easy.
From what I understand it's fairly common convention to always use future annotations to have type safety with minimizing runtime overhead. It's the default from Python 3.14 - actually I came up with this when I realized now it's relatively easy writing code that works on 3.14 but crashes on others due to the differing behavior (almost always caught by unit tests but just a developer convenience too).