Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Add fix-future-annotations with pre-commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
boholder committed Dec 8, 2022
1 parent e4121e5 commit 7ba9738
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,46 @@ ci:
autoupdate_commit_msg: "Auto update by pre-commit hooks"

repos:
# automatically upgrade the syntax.
# upgrade the syntax.
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade

# for code style formatting
# adding "from __future__ import annotations" for enabling new features
- repo: https://github.com/frostming/fix-future-annotations
rev: 0.5.0
hooks:
- id: fix-future-annotations

# code style formatting
# see pyproject.toml for config
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black

# for removing unused import statements
# removing unused import statements
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.2
hooks:
- id: pycln

# for import sentences sorting
# import sentences sorting
# see pyproject.toml for config
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

# for typo checking
# typo checking
# see setup.cfg for config
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell

# for common python problem checking
# common python problem checking
# see setup.cfg for config
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ known_third_party = [
"pytest",
]

[tool.fix_future_annotations]
exclude_lines = [ # regex patterns to exclude lines
'class .+\(BaseModel\):' # classes that inherit from `BaseModel` will be excluded
]

# The key config for building executable wheel
# https://github.com/pypa/pipx#where-does-pipx-install-apps-from
# https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-console-scripts-entry-point
Expand Down

0 comments on commit 7ba9738

Please sign in to comment.