diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..dccdedc7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +# pre-commit config, per https://pre-commit.com/ +# +# These hooks only use local commands. +repos: + - repo: local + hooks: + - id: pylint + name: pylint + entry: pylint + language: system + types: [python] + require_serial: true diff --git a/README.md b/README.md index e405403b..b1df804f 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,18 @@ deactivate # Development +## Cloning and setup + +* Clone as usual +* set up your virtual environment, install all dev dependencies from requirements.txt, activate it +* Install the git pre-commit hooks: `pre-commit install` + +## Commit hooks + +Pre-commit hooks are installed with the `pre-commit install` step, and are run on every commit. + +Skipping a step: `SKIP=pylint git commit -m "Some non-lint-compliant commit."` + ## Using invoke for tasks Lute3 uses [Invoke](https://docs.pyinvoke.org/en/stable/index.html) to run tasks. Tasks are in `tasks.py`. diff --git a/pyproject.toml b/pyproject.toml index 3b4a4fc2..a869fc14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,8 @@ dev = [ "pipdeptree>=2.13.0,<3", "pylint>=2.17.5,<3", "pytest-bdd>=7.0.0,<8", - "pytest-splinter>=3.3.2,<4" + "pytest-splinter>=3.3.2,<4", + "pre-commit>=3.5.0,<4" ] [project.urls] diff --git a/requirements.txt b/requirements.txt index 78de2e35..9078d05a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,18 +4,22 @@ beautifulsoup4==4.12.2 blinker==1.6.2 certifi==2023.7.22 cffi==1.16.0 +cfgv==3.4.0 charset-normalizer==3.3.1 click==8.1.7 coverage==7.3.1 dill==0.3.7 +distlib==0.3.7 docutils==0.20.1 exceptiongroup==1.1.3 +filelock==3.13.1 Flask==2.3.3 Flask-SQLAlchemy==3.1.1 Flask-WTF==1.2.1 flit==3.9.0 flit_core==3.9.0 h11==0.14.0 +identify==2.5.31 idna==3.4 importlib-metadata==6.8.0 iniconfig==2.0.0 @@ -28,6 +32,7 @@ Mako==1.2.4 MarkupSafe==2.1.3 mccabe==0.7.0 natto-py==1.0.1 +nodeenv==1.8.0 outcome==1.3.0.post0 packaging==23.1 parse==1.19.1 @@ -35,6 +40,7 @@ parse-type==0.6.2 pipdeptree==2.13.0 platformdirs==3.10.0 pluggy==1.3.0 +pre-commit==3.5.0 pycparser==2.21 pylint==2.17.5 PySocks==1.7.1 @@ -58,6 +64,7 @@ trio==0.22.2 trio-websocket==0.11.1 typing_extensions==4.8.0 urllib3==1.26.18 +virtualenv==20.24.6 waitress==2.1.2 Werkzeug==2.3.7 wrapt==1.15.0