Skip to content

Commit

Permalink
añade hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
albertotb committed Oct 20, 2023
1 parent 972b841 commit 7f4c510
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ repos:
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii]
exclude: .vscode/settings.json
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
Expand All @@ -40,4 +49,9 @@ repos:
- id: pip-compile
name: pip-compile requirements-dev
args: [--constraint=requirements.txt, --extra=dev, --output-file=requirements-dev.txt, pyproject.toml]
files: ^(pyproject\.toml|requirements-dev\.txt)$
files: ^(pyproject\.toml|requirements-dev\.txt)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
- id: mypy
args: [--ignore-missing-imports]
5 changes: 2 additions & 3 deletions template/main.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/usr/bin/env python
from importlib.metadata import PackageNotFoundError, version
from typing import Optional

import typer

try:
__version__: Optional[str] = version("template")
__version__: str | None = version("template")
except PackageNotFoundError:
# package is not installed
__version__ = None
pass


def print_version():
def print_version() -> None:
print(f"Template version {__version__}")


Expand Down

0 comments on commit 7f4c510

Please sign in to comment.