diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfa8a58..6f98705 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -44,15 +24,6 @@ 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: @@ -60,8 +31,9 @@ repos: 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 diff --git a/pyproject.toml b/pyproject.toml index 60701b7..275234d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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'