Skip to content

Commit 0561221

Browse files
committed
TEMPORARY Introduce pre-commit workflow for consistency
1 parent e5df31c commit 0561221

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/pytest.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,17 @@ jobs:
7474
run: |
7575
source .venv/bin/activate
7676
pytest --cov-report xml:.coverage.xml --cov-report term --cov=ixmp4 -rsx --benchmark-skip
77+
78+
pre-commit:
79+
name: Code quality
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v3
83+
- uses: actions/setup-python@v4
84+
85+
- name: Force recreation of pre-commit virtual environment for mypy
86+
if: github.event_name == 'schedule' # Comment this line to run on a PR
87+
run: gh cache delete $(gh cache list -L 999 | cut -f2 | grep pre-commit)
88+
env: { GH_TOKEN: "${{ github.token }}" }
89+
90+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
repos:
2+
# - repo: https://github.com/python-poetry/poetry
3+
# rev: 30da950 #update this to next revision that include poetry-install
4+
# hooks:
5+
# - id: poetry-check
6+
# - id: poetry-lock
7+
# - id: poetry-export
8+
# - id: poetry-install
9+
- repo: local
10+
hooks:
11+
- id: mypy
12+
name: mypy
13+
always_run: true
14+
require_serial: true
15+
pass_filenames: false
16+
17+
language: python
18+
entry: bash -c ". ${PRE_COMMIT_MYPY_VENV:-/dev/null}/bin/activate 2>/dev/null; mypy $0 $@"
19+
# additional_dependencies:
20+
# - alembic
21+
# - black
22+
# - dask
23+
# - fastapi
24+
# - httpx
25+
# - ipykernel
26+
# - mypy
27+
# - nbclient
28+
# - pandas-stubs
29+
# - pandera
30+
# - psycopg[binary]
31+
# - pydantic
32+
# - pydantic-settings
33+
# - pyjwt
34+
# - pytest
35+
# - python-dotenv
36+
# - sphinx
37+
# - sqlalchemy
38+
# - types-toml
39+
# - typer
40+
# - xarray
41+
args: ["."]
42+
- repo: https://github.com/psf/black
43+
rev: 23.9.1
44+
hooks:
45+
- id: black
46+
- repo: https://github.com/astral-sh/ruff-pre-commit
47+
rev: v0.0.292
48+
hooks:
49+
- id: ruff

0 commit comments

Comments
 (0)