Skip to content

Commit

Permalink
fix(build): add pre-commit as a dev dependency to simplify local de…
Browse files Browse the repository at this point in the history
…v and CI (#438)

I could not install pre-commit handler because the package was missing
in [tool.poetry.group.dev.dependencies].

I also updated the configuration for the pre-commit handler as black and
ruff packages were outdated. Also removed deprecation for ruff v0.3.0
config in pyproject.toml.

---------

Co-authored-by: Balint Bartha <39852431+totallyzen@users.noreply.github.com>
  • Loading branch information
max-pfeiffer and totallyzen committed Mar 4, 2024
1 parent 7358b49 commit 1223583
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 17 deletions.
8 changes: 3 additions & 5 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: pre-commit run -a
run: poetry install --no-interaction
- name: Execute pre-commit handler
run: poetry run pre-commit run -a
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.9
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -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
125 changes: 122 additions & 3 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"
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 1223583

Please sign in to comment.