diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e50a55..bbc7a7e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,6 @@ variables: PYTHON_LINT_RUFF: "true" PYTHON_LINT_MYPY: "true" PYTHON_LINT_PYLINT: "true" - PYTHON_FMT_BLACK: "true" PYTHON_JOB_PYTEST: "true" MYPY_CMD: pdm run lint-mypy diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29ff81f..04e2c62 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,4 @@ repos: hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.1.1 - hooks: - - id: black + - id: ruff-format diff --git a/.vscode/extensions.json b/.vscode/extensions.json index bff2974..a388f21 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,7 +3,6 @@ "mikestead.dotenv", "davidanson.vscode-markdownlint", "ms-python.vscode-pylance", - "ms-python.black-formatter", "tamasfe.even-better-toml", "charliermarsh.ruff" ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 9844546..8a2d237 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,7 @@ "--rootdir=." ], "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter", + "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": "explicit", diff --git a/README.md b/README.md index 139df09..2c448a8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Loggia -[![PyPI - Version](https://img.shields.io/pypi/v/loggia)](https://pypi.org/project/loggia/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/loggia)](https://pypi.org/project/loggia/) [![PyPI - License](https://img.shields.io/pypi/l/loggia)](https://github.com/ManoManoTech/loggia/blob/main/LICENSE) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/astral-sh/ruff) +[![PyPI - Version](https://img.shields.io/pypi/v/loggia)](https://pypi.org/project/loggia/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/loggia)](https://pypi.org/project/loggia/) [![PyPI - License](https://img.shields.io/pypi/l/loggia)](https://github.com/ManoManoTech/loggia/blob/main/LICENSE) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/astral-sh/ruff) > **The documentation is available on Github Pages** > diff --git a/pdm.lock b/pdm.lock index 228b6da..ff85bb6 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "ddtrace", "debug", "dev", "doc", "loguru", "rich", "tests"] strategy = ["cross_platform", "static_urls"] lock_version = "4.4.1" -content_hash = "sha256:3562ae7c79aa1338a73bee51d74f1ad83a4bd548ec72564bb37d071bbaa66cbf" +content_hash = "sha256:74fce8ee5b897d489acf649e2b5d2f968d2fc254bf2e415cdddc2dca8e3e2421" [[package]] name = "annotated-types" @@ -62,41 +62,6 @@ files = [ {url = "https://files.pythonhosted.org/packages/e2/80/cfbe44a9085d112e983282ee7ca4c00429bc4d1ce86ee5f4e60259ddff7f/Babel-2.14.0.tar.gz", hash = "sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363"}, ] -[[package]] -name = "black" -version = "24.1.1" -requires_python = ">=3.8" -summary = "The uncompromising code formatter." -dependencies = [ - "click>=8.0.0", - "mypy-extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < \"3.11\"", - "typing-extensions>=4.0.1; python_version < \"3.11\"", -] -files = [ - {url = "https://files.pythonhosted.org/packages/17/9e/104321dd49d30f7e9475afef76db7ad14b43f56933a315a657504d8fbdd7/black-24.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e2c8dfa14677f90d976f68e0c923947ae68fa3961d61ee30976c388adc0b02c8"}, - {url = "https://files.pythonhosted.org/packages/1d/25/85c545f605f005a1724ccc654f4981461ea0234835ba7689f6c5a97d3e5d/black-24.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:5d7b06ea8816cbd4becfe5f70accae953c53c0e53aa98730ceccb0395520ee5d"}, - {url = "https://files.pythonhosted.org/packages/4a/7d/044d6e90a28b4bb4bfd281b478867457ee9395caf876318ac5cfc05af2f8/black-24.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:ecba2a15dfb2d97105be74bbfe5128bc5e9fa8477d8c46766505c1dda5883aac"}, - {url = "https://files.pythonhosted.org/packages/51/9c/66639d55f96ca0dff924db2b72f03fccac90c1b8fe0f7f33452669d1bdb9/black-24.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3897ae5a21ca132efa219c029cce5e6bfc9c3d34ed7e892113d199c0b1b444a2"}, - {url = "https://files.pythonhosted.org/packages/55/14/07a41fb78fe81aa4852f16af4211fab5a130fcd3150b44a336042a3252d5/black-24.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07204d078e25327aad9ed2c64790d681238686bce254c910de640c7cc4fc3aa6"}, - {url = "https://files.pythonhosted.org/packages/77/ec/a429d15d2e7f996203bff98e2b2e84ad4cb3de318de147b0038dc93fbc71/black-24.1.1.tar.gz", hash = "sha256:48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b"}, - {url = "https://files.pythonhosted.org/packages/95/9e/70f6f3e8e3137c282f7729241d6fede8a1e0dc7a14653c8ac54530b0ea0d/black-24.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2588021038bd5ada078de606f2a804cadd0a3cc6a79cb3e9bb3a8bf581325a4c"}, - {url = "https://files.pythonhosted.org/packages/95/f3/c3d59ae490c627950efc97a27c3f73776577e2ec32d35737e72aee3d6738/black-24.1.1-py3-none-any.whl", hash = "sha256:5cdc2e2195212208fbcae579b931407c1fa9997584f0a415421748aeafff1168"}, - {url = "https://files.pythonhosted.org/packages/a8/3e/9e02aa484f3c0f23ccbb69152b0d20d239b78aed87c15e8583bd92dcc8c4/black-24.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a95915c98d6e32ca43809d46d932e2abc5f1f7d582ffbe65a5b4d1588af7445"}, - {url = "https://files.pythonhosted.org/packages/b8/ee/baf094c4cc0bf2345af8690edb7f32cadf29ba81d6a9eef21ddea42de728/black-24.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:34afe9da5056aa123b8bfda1664bfe6fb4e9c6f311d8e4a6eb089da9a9173bf9"}, - {url = "https://files.pythonhosted.org/packages/be/ff/9380fb957347ab897543b53228cfd85112e421bdaf243e3865fa2d5e80ce/black-24.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a21725862d0e855ae05da1dd25e3825ed712eaaccef6b03017fe0853a01aa45e"}, - {url = "https://files.pythonhosted.org/packages/c0/92/cc543b133cd1337cbfce3e7d2c9d45b5e913224ed1fc791875d062d7be46/black-24.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0269dfdea12442022e88043d2910429bed717b2d04523867a85dacce535916b8"}, - {url = "https://files.pythonhosted.org/packages/d5/9f/939787bd274d55c235d3f6692c7b40f92c9538b6875c4a838e5baf4dcf09/black-24.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:5242ecd9e990aeb995b6d03dc3b2d112d4a78f2083e5a8e86d566340ae80fec4"}, - {url = "https://files.pythonhosted.org/packages/de/bb/27d8b72ae150a5b11eeeb332a23ab53e2965d6c575a069ced0d8a42630e8/black-24.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:854c06fb86fd854140f37fb24dbf10621f5dab9e3b0c29a690ba595e3d543024"}, - {url = "https://files.pythonhosted.org/packages/e5/fa/eaa2c165840a2496654366fcdc17f63459b89e3296b9269a18ba6d71f596/black-24.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:a83fe522d9698d8f9a101b860b1ee154c1d25f8a82ceb807d319f085b2627c5b"}, - {url = "https://files.pythonhosted.org/packages/e8/e3/8519496759b4f15d73323b00f70bde3eb097efd177382a4bed3899162a9e/black-24.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3d64db762eae4a5ce04b6e3dd745dcca0fb9560eb931a5be97472e38652a161"}, - {url = "https://files.pythonhosted.org/packages/ee/93/8abf6f3722460eb53f37a55356cd33462502748867d767ec2adc4d43cecd/black-24.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fa6a0e965779c8f2afb286f9ef798df770ba2b6cee063c650b96adec22c056a"}, - {url = "https://files.pythonhosted.org/packages/ef/cc/b205025212eaa90a73985873d5b88210d7c337c02afc4d9fa6ce438a080f/black-24.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fc1ec9aa6f4d98d022101e015261c056ddebe3da6a8ccfc2c792cbe0349d48b7"}, -] - [[package]] name = "bracex" version = "2.4" diff --git a/pyproject.toml b/pyproject.toml index d231983..7e08e36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,12 +72,12 @@ lint = { composite = [ "lint-mypy", ], help = "Run all linters (ruff, pylint, mypy)." } # Format -fmt-black = { cmd = "black .", help = "Run black formatter" } +fmt-black = { cmd = "ruff format .", help = "Run ruff black-like formatter" } fmt-ruff = { cmd = "ruff . --fix --select I001", help = "Run isort-like import sorting with ruff" } fmt = { composite = [ "fmt-black", "fmt-ruff", -], help = "Run all formatters (black, isort-like ruff)" } +], help = "Run all formatters (black-like ruff, isort-like ruff)" } # Tests test = { cmd = "pytest", help = "Run the tests" } test-cov = { cmd = "pytest --junitxml=pytest-report.xml --cov --cov-report xml:pytest-coverage.xml --cov-fail-under=0 --cov-report html", help = "Run the tests with coverage, and generate reports" } @@ -88,7 +88,6 @@ docs-build = { cmd = "mkdocs build --strict", help = "Build the docs" } [tool.pdm.dev-dependencies] dev = [ - "black>=22.12.0", "mypy>=1.4", "pylint>=3.0.3", "pytest-cov>=4.0.0", @@ -146,9 +145,6 @@ exclude_lines = [ '@(abc\.)?abstractmethod]', ] -[tool.black] -line-length = 140 -target-version = ['py39'] [tool.pylint] [tool.pylint.main] @@ -194,6 +190,8 @@ ignore = [ "N817", # CamelCase `XxXx` imported as acronym `XX` "N813", # CamelCase `XxXx` imported as lowercase `xxxx` "ICN003", # Members of `datetime` should not be imported explicitely + "COM812", # Conflicts with formatter + "ISC001", # Conflicts with formatter ] select = ["ALL"] [tool.ruff.pydocstyle]