diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0deef7b..e134380 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,26 +11,13 @@ ci: submodules: false repos: - - repo: https://github.com/psf/black - rev: 24.1.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.1 hooks: - - id: black - language_version: python3.9 - - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort - # args: ["--profile", "black", "--filter-files"] - additional_dependencies: [toml] - files: \.py$ - language_version: python3.9 - - - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 - hooks: - - id: flake8 - language_version: python3.9 + # Run the linter. + - id: ruff + args: [ --fix ] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 5ea734b..f11adc8 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -71,7 +71,7 @@ Below are a few examples of how to run tox: Code style ---------- -- We use flake8_ to enforce `PEP 8`_ conventions, isort_ to sort our imports, and we use the black_ formatter with a line length of 88 characters. +- We use ruff_ for linting and formatting Python code. Static typing is enforced using mypy_. Code that does not follow these conventions won't pass our CI. These tools are configured in either ``tox.ini`` or ``pyproject.toml``. @@ -144,15 +144,11 @@ Docs - If you add a new feature, include one or more usage examples in ``examples.rst``. -.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/backward-compatibility.html .. _tox: https://tox.readthedocs.io/ .. _reStructuredText: https://www.sphinx-doc.org/en/stable/usage/ .. _`Sphinx-style format`: https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html#the-sphinx-docstring-format .. _semantic newlines: https://rhodesmill.org/brandon/2012/one-sentence-per-line/restructuredtext/basics.html .. _CI: https://github.com/blancadesal/mwsql/actions -.. _black: https://github.com/psf/black -.. _pre-commit: https://pre-commit.com/ -.. _isort: https://github.com/PyCQA/isort -.. _flake8: https://flake8.pycqa.org/en/latest/ +.. _ruff: https://github.com/astral-sh/ruff-pre-commit .. _mypy: https://mypy.readthedocs.io/en/stable/ .. _pytest: https://docs.pytest.org/en/6.2.x/ diff --git a/pyproject.toml b/pyproject.toml index 063ba0e..492398d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,3 @@ toml = "^0.10.2" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" - -[tool.black] -line-length = 88 - -[tool.isort] -profile = "black" -multi_line_output = 3 diff --git a/tox.ini b/tox.ini index e091cb7..973140e 100644 --- a/tox.ini +++ b/tox.ini @@ -54,10 +54,3 @@ commands = basepython = python3.9 commands = poetry run mypy ./src - -[flake8] -# Match the Black line length (default 88), -# rather than using the flake8 default of 79: -max-line-length = 88 -extend-ignore = E203, W503 -ignore = E127, E501