Skip to content

Commit

Permalink
Add nbqa for isort in notebooks and ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasKoehneckeAA committed Apr 4, 2024
1 parent 06cbfcd commit 298da8b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 19 deletions.
34 changes: 19 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ repos:
exclude: trace-viewer/
- id: trailing-whitespace
exclude: trace-viewer/
- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
verbose: true
- repo: https://github.com/psf/black
rev: 24.3.0
- id: nbqa-isort
additional_dependencies: [isort]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.5
hooks:
- id: black
# https://black.readthedocs.io/en/stable/integrations/source_version_control.html#version-control-integration
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.3.0
hooks:
- id: black-jupyter
# Run the linter.
- id: ruff
args: [ --fix ]
types_or: [ python, pyi, jupyter ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
Expand All @@ -38,7 +38,11 @@ repos:
rev: v2.2.6
hooks:
- id: codespell
args: ["-L", "newyorker,te,responde,ist,als,oder,technik,sie,rouge,unter,juli,fiel,couldn,mke, vor"]
args:
[
"-L",
"newyorker,te,responde,ist,als,oder,technik,sie,rouge,unter,juli,fiel,couldn,mke, vor",
]
exclude: '^(poetry\.lock|trace-viewer/.*|tests/connectors/retrievers/test_document_index_retriever\.py|src/intelligence_layer/use_cases/qa/multiple_chunk_qa.py|src/intelligence_layer/use_cases/summarize/.*|tests/connectors/retrievers/test_document_index_retriever\.py|src/intelligence_layer/use_cases/classify/keyword_extract.py|tests/use_cases/summarize/test_single_chunk_few_shot_summarize.py|tests/use_cases/summarize/very_long_text.txt)$'
- repo: https://github.com/akaihola/darglint2
rev: v1.8.2
Expand Down
66 changes: 63 additions & 3 deletions poetry.lock

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

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ nbconvert = "^7.16.3"
datasets = "^2.18.0"
jupyter = "^1.0.0"
requests = "^2.31.0"
pytest-xdist = "^3.5.0"
langdetect = "^1.0.9"
nltk = "^3.8.1"
pycountry = "23.12.11"
Expand All @@ -38,6 +37,7 @@ opentelemetry-exporter-otlp-proto-http = "1.23.0"
[tool.poetry.group.dev.dependencies]
mypy = "^1.9.0"
pytest = "*"
pytest-xdist = "^3.5.0"
black = { extras = ["jupyter"], version = "^24.3.0" }
pre-commit = "*"
httpx = "*"
Expand All @@ -54,6 +54,8 @@ pylama = { extras = ["all", "toml"], version = "^8.4.1" }
faker = "^24.4.0"
hypercorn = "0.16.0"
pandas-stubs = "^2.2.1.240316"
nbqa = "^1.8.5"
ruff = "^0.3.5"

[tool.mypy]
files = "src,tests"
Expand All @@ -72,5 +74,8 @@ filterwarnings = [
skip = "*/__init__.py,.venv/*,*/node_modules/*"
ignore = "E501,E203"

[tool.ruff]
extend-include = ["*.ipynb"]

[tool.pylama.linter.mccabe]
max-complexity = "11"

0 comments on commit 298da8b

Please sign in to comment.