This PR introduces a flake8 plugin, flake8-future-import to automatically check missing __future__ import annotations.
Details
Currently, some code requires __future__ import annotations to use type annotation (e.g., PEP 604 available in Python 3.10) across Python 3.8, 3.9, and 3.10. It's more consistent to add the import for every Python file except third party, but it's easy to forget to add it without CI. That's where flake8-future-import comes in.
flake8-future-import enables flake8 to check the import automatically. This PR adds a new pre-commit hook dedicated to the plugin to exclude third-party code from the check. I added error codes to the config file to silence flake8 so that flake8 doesn't check features other than annotations, because the plugin is designed to lint all the features by default.
Note that this PR bumps flake8 version to use the latest version of the plugin.
Overview
This PR introduces a flake8 plugin, flake8-future-import to automatically check missing
__future__ import annotations
.Details
Currently, some code requires
__future__ import annotations
to use type annotation (e.g., PEP 604 available in Python 3.10) across Python 3.8, 3.9, and 3.10. It's more consistent to add the import for every Python file except third party, but it's easy to forget to add it without CI. That's where flake8-future-import comes in.flake8-future-import enables flake8 to check the import automatically. This PR adds a new pre-commit hook dedicated to the plugin to exclude third-party code from the check. I added error codes to the config file to silence flake8 so that flake8 doesn't check features other than
annotations
, because the plugin is designed to lint all the features by default. Note that this PR bumps flake8 version to use the latest version of the plugin.References
Blocked by