Skip to content

Instantly share code, notes, and snippets.

@sa-
Last active May 8, 2023 06:04
Show Gist options
  • Save sa-/295d363302775d09d62839d9e2615f12 to your computer and use it in GitHub Desktop.
Save sa-/295d363302775d09d62839d9e2615f12 to your computer and use it in GitHub Desktop.
.PHONY: dev
dev:
pip install -qU pip
poetry config virtualenvs.in-project true
poetry install --no-root
poetry run pre-commit install
poetry run pre-commit run -a
.PHONY: fmt
fmt:
poetry run pre-commit run -a
.PHONY: install_python
install_python:
CONFIGURE_OPTS=--enable-shared pyenv install $$(cat .python-version | tr -d '\n')
---
minimum_pre_commit_version: 1.21.0
fail_fast: false
default_stages: [ commit, push ]
repos:
# formatters
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
# linters
- repo: local
hooks:
- id: pytest
name: pytest
entry: poetry run pytest
language: system
types: [ python ]
files: ^tests\/.*test_.*\.py$
pass_filenames: false # or use with: require_serial
- id: mypy
name: mypy
entry: poetry run mypy --strict
types: [ python ]
language: system
- id: ruff
name: ruff
entry: poetry run ruff check
types: [ python ]
language: system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment