Skip to content

Commit

Permalink
Split pre commit config into single executable tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
gutzbenj committed Dec 22, 2023
1 parent cc449eb commit 739bb18
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install '.[dev,examples]'
pip install '.[dev]'
- name: Lint
run: pre-commit run --all-files
run: poe lint
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
pip install '.[dev,examples]'
- name: Test
run: pytest
run: poe test

- name: Examples
run: python examples/check_timesteps.py tests/data
38 changes: 38 additions & 0 deletions .github/workflows/typing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Typing

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

# Allow job to be triggered manually.
workflow_dispatch:

# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
typing:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: x64
cache: pip

- name: Install project
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
- name: Typing
run: poe typing
18 changes: 0 additions & 18 deletions .pre-commit-config.yaml

This file was deleted.

22 changes: 21 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies = ["click~=8.0", "pandas~=1.3"]
isd = "isd.cli:main"

[project.optional-dependencies]
dev = ["mypy~=1.2", "pre-commit~=3.2", "pytest~=7.4", "ruff~=0.1.9"]
dev = ["mypy~=1.2", "pytest~=7.4", "ruff~=0.1.9", "poethepoet>=0.24.4", "black>=23.12"]
examples = ["tqdm~=4.66"]
docs = ["sphinx~=7.2"]

Expand All @@ -27,3 +27,23 @@ build-backend = "setuptools.build_meta"

[tool.mypy]
strict = true

[tool.poe.tasks]
format = [
{ cmd = "black ." },
{ cmd = "ruff --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." },
]

lint = [
{ cmd = "ruff ." },
{ cmd = "black --check ." },
]

typing = [
{ cmd = "mypy src --ignore-missing-imports" },
{ cmd = "mypy tests --ignore-missing-imports" },
]

test = [
{ cmd = "pytest" },
]

0 comments on commit 739bb18

Please sign in to comment.