Skip to content

Commit

Permalink
Added pre-commit as development dependency, updated pre-commit config
Browse files Browse the repository at this point in the history
pre-commit package was not present in development dependency,
so pre-commit handler could not be installed locally.
Also simplified CI for linting a bit.

Removed black and ruff from dev dependencies

After thinking about it again, just using pre-commit
handling in CI is a simpler approach also for maintenance.
  • Loading branch information
max-pfeiffer committed Mar 2, 2024
1 parent 7358b49 commit 3b0f6dc
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 16 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
with:
python-version: "3.9" # the pre-commit is hooked in as 3.9
- name: Install Python dependencies
run: poetry install
- name: Install pre-commit
run: pip install pre-commit
- name: Run linter
run: poetry install --no-interaction
- name: Execute pre-commit handler
run: pre-commit run -a
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/psf/black-pre-commit-mirror
rev: '24.1.1'
rev: '24.2.0'
hooks:
- id: black
args: [ '--config', 'pyproject.toml' ]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.14'
rev: 'v0.3.0'
hooks:
- id: ruff
# Explicitly setting config to prevent Ruff from using `pyproject.toml` in sub packages.
Expand Down
130 changes: 126 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ redis = ["redis"]
selenium = ["selenium"]

[tool.poetry.group.dev.dependencies]
mypy = "1.7.1"
pre-commit = "3.6.2"
pg8000 = "*"
pytest = "7.4.3"
pytest-cov = "4.1.0"
sphinx = "^7.2.6"
pg8000 = "*"
twine = "^4.0.2"
mypy = "1.7.1"

[[tool.poetry.source]]
name = "PyPI"
Expand All @@ -139,15 +140,14 @@ exclude_lines = [
"raise NotImplementedError" # TODO: used in core/generic.py, not sure we need DbContainer
]

[tool.ruff.flake8-type-checking]
strict = true

[tool.ruff]
target-version = "py39"
line-length = 120
fix = true
fixable = ["I"]
src = ["core", "modules/*"]

[tool.ruff.lint]
fixable = ["I"]
exclude = ["**/tests/**/*.py"]
select = [
# flake8-2020
Expand Down Expand Up @@ -194,6 +194,8 @@ ignore = [
"INP001"
]

[tool.ruff.lint.flake8-type-checking]
strict = true

[tool.mypy]
python_version = "3.9"
Expand Down

0 comments on commit 3b0f6dc

Please # to comment.