diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7d6fe16 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: +- repo: local + hooks: + - id: flake8 + name: flake8 + entry: flake8 + language: system + types: [python] + - id: isort + name: isort + entry: isort + language: system + types: [python] + - id: black + name: black + entry: black + language: system + types: [python] diff --git a/Makefile b/Makefile index 508075b..e920ed0 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ .PRECIOUS: .SUFFIXES: -SHELL:=/bin/bash -e -o pipefail -O globstar +SHELL:=/bin/bash -e -o pipefail #-O globstar SELF:=$(firstword $(MAKEFILE_LIST)) VE_DIR=venv @@ -45,6 +45,7 @@ ${VE_DIR}: .PHONY: develop develop: pip install -e .[dev] + pre-commit install #=> install: install package .PHONY: install diff --git a/README.md b/README.md index 3865a41..e236fea 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ Code reformatting: make reformat +Install pre-commit hook: + + # included in `make devready`, not necessary for new installations + pre-commit install + Test: make test # for current environment diff --git a/pyproject.toml b/pyproject.toml index fcc19d2..669caa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,6 +76,10 @@ exclude_lines = [ [tool.black] line-length = 100 +[tool.isort] +profile = "black" +src_paths = ["src"] + # [tool.flake8] # flake8 does not support configuration in pyproject.toml diff --git a/setup.cfg b/setup.cfg index 9817ed5..3d1d769 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ dev = ipython~=8.4 isort~=5.10 mypy + pre-commit~=3.4 pylint~=2.14 pytest-cov~=4.1 pytest-optional-tests