Skip to content

Commit

Permalink
chore: removed black and isort from dev dependencies and used ruff in…
Browse files Browse the repository at this point in the history
… pre-commit instead
  • Loading branch information
eschmidt42 committed Mar 4, 2024
1 parent aa17926 commit 9ca6dae
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 41 deletions.
35 changes: 13 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,22 @@ repos:
- id: fix-encoding-pragma
- id: name-tests-test
args: ['--pytest-test-first']
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: nbqa-black
- id: nbqa-isort
args: ["--float-to-top"]
- id: ruff
types_or: [ python, pyi, jupyter ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
- id: nbstripout
- repo: local
hooks:
- id: isort
name: isort
entry: isort
language: python
types_or: [python, pyi]
- id: black
name: black
entry: black
language: python
types_or: [python, pyi]
- id: pytest
name: pytest
entry: python3 -m pytest -vx -m "not slow"
pass_filenames: false
language: system
types: [python]
- id: pytest
name: pytest
entry: python3 -m pytest -vx -m "not slow"
pass_filenames: false
language: system
types: [python]
66 changes: 60 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,68 @@ classifiers = [
keywords = ["neural-networks", "machine-learning", "deep-learning"]
# dependencies = [] - now via requirements/*.in files

[tool.black]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 80
indent-width = 4

# Assume Python 3.11
target-version = "py311"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

[tool.isort]
multi_line_output = 3
line_length = 80
include_trailing_comma = true
profile = "black"
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

[tool.setuptools.packages.find]
where = ["src"] # list of folders that contain the packages (["."] by default)
Expand Down
2 changes: 0 additions & 2 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
-c core.txt
-c test.txt
-c publish.txt
black
isort
pre-commit
jupyterlab
jupyter-contrib-nbextensions
Expand Down
11 changes: 0 additions & 11 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ babel==2.14.0
# via jupyterlab-server
beautifulsoup4==4.12.3
# via nbconvert
black==24.2.0
# via -r requirements/dev.in
bleach==6.1.0
# via nbconvert
bumpver==2023.1129
Expand All @@ -53,7 +51,6 @@ charset-normalizer==3.3.2
click==8.1.7
# via
# -c requirements/core.txt
# black
# bumpver
colorama==0.4.6
# via bumpver
Expand Down Expand Up @@ -107,8 +104,6 @@ ipywidgets==8.1.2
# via -r requirements/dev.in
isoduration==20.11.0
# via jsonschema
isort==5.13.2
# via -r requirements/dev.in
jedi==0.19.1
# via ipython
jinja2==3.1.3
Expand Down Expand Up @@ -200,8 +195,6 @@ matplotlib-inline==0.1.6
# ipython
mistune==3.0.2
# via nbconvert
mypy-extensions==1.0.0
# via black
nbclient==0.9.0
# via nbconvert
nbconvert==7.16.0
Expand Down Expand Up @@ -233,7 +226,6 @@ packaging==23.2
# -c requirements/core.txt
# -c requirements/publish.txt
# -c requirements/test.txt
# black
# ipykernel
# jupyter-server
# jupyterlab
Expand All @@ -243,13 +235,10 @@ pandocfilters==1.5.1
# via nbconvert
parso==0.8.3
# via jedi
pathspec==0.12.1
# via black
pexpect==4.9.0
# via ipython
platformdirs==4.2.0
# via
# black
# jupyter-core
# virtualenv
pre-commit==3.6.1
Expand Down

0 comments on commit 9ca6dae

Please sign in to comment.