Skip to content

Commit

Permalink
Move to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
dirmeier committed Feb 29, 2024
1 parent 513e8fd commit c4aac76
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 74 deletions.
38 changes: 5 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
args: ["--config=pyproject.toml"]
files: "(sbijax|examples)"

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-path=pyproject.toml"]
files: "(sbijax|examples)"

- repo: https://github.com/pycqa/bandit
rev: 1.7.1
hooks:
Expand All @@ -44,24 +24,16 @@ repos:
additional_dependencies: ["toml"]
files: "(sbijax|examples)"

- repo: https://github.com/PyCQA/flake8
rev: 5.0.1
hooks:
- id: flake8
additional_dependencies: [
flake8-typing-imports==1.14.0,
flake8-pyproject==1.1.0.post0
]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
hooks:
- id: mypy
args: ["--ignore-missing-imports"]
files: "(sbijax|examples)"

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: pydocstyle
additional_dependencies: ["toml"]
- id: ruff
args: [ --fix ]
- id: ruff-format
55 changes: 14 additions & 41 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license = "Apache-2.0"
homepage = "https://github.com/dirmeier/sbijax"
keywords = ["abc", "simulation-based inference", "approximate Bayesian computation", "normalizing flows", "smc-abc"]
classifiers = [
"Development Status :: 1 - Planning",
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
Expand Down Expand Up @@ -57,54 +57,27 @@ dependencies = [

[tool.hatch.envs.test]
dependencies = [
"pylint>=2.15.10",
"ruff>=0.3.0",
"pytest>=7.2.0",
"pytest-cov>=4.0.0"
]

[tool.hatch.envs.test.scripts]
lint = 'pylint sbijax'
test = 'pytest -v --cov=./sbijax --cov-report=xml sbijax'

[tool.black]
line-length = 80
target-version = ['py311']
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
lint = 'ruff check surjectors'
test = 'pytest -v --cov=./surjectors --cov-report=xml surjectors'

[tool.bandit]
skips = ["B101"]

[tool.isort]
profile = "black"
line_length = 80
include_trailing_comma = true
[tool.ruff]
line-length = 80
exclude = ["*_test.py", "docs/**", "examples/**"]

[tool.flake8]
max-line-length = 80
extend-ignore = ["E203", "W503", "E731", "E231"]
per-file-ignores = [
'__init__.py:F401',
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
extend-select = [
"UP", "D", "I", "PL", "S"
]

[tool.pylint.messages_control]
disable = """
invalid-name,missing-module-docstring,R0801,E0633
"""

[tool.bandit]
skips = ["B101"]

[tool.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention= 'google'
match = '^sbijax/.*/((?!_test).)*\.py'

0 comments on commit c4aac76

Please sign in to comment.