From a9ec0ded71fea07fd28443799e46a0c511976738 Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 11:54:32 +0000 Subject: [PATCH 1/6] Replace Black with ruff format --- .pre-commit-config.yaml | 8 +--- poetry.lock | 97 ++++++++--------------------------------- pyproject.toml | 13 +++--- requirements-dev.txt | 8 ++-- 4 files changed, 31 insertions(+), 95 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 476eca8..a846d80 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,15 +27,11 @@ repos: - id: auto-walrus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.1.9' # Must match requirements-dev.txt + rev: 'v0.1.15' # Must match requirements-dev.txt hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] - - - repo: https://github.com/psf/black - rev: 23.12.1 # Must match requirements-dev.txt - hooks: - - id: black + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 # Must match requirements-dev.txt diff --git a/poetry.lock b/poetry.lock index 9294eb8..a381854 100644 --- a/poetry.lock +++ b/poetry.lock @@ -225,54 +225,6 @@ soupsieve = ">1.2" html5lib = ["html5lib"] lxml = ["lxml"] -[[package]] -name = "black" -version = "23.12.1" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.8" -files = [ - {file = "black-23.12.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0aaf6041986767a5e0ce663c7a2f0e9eaf21e6ff87a5f95cbf3675bfd4c41d2"}, - {file = "black-23.12.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c88b3711d12905b74206227109272673edce0cb29f27e1385f33b0163c414bba"}, - {file = "black-23.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a920b569dc6b3472513ba6ddea21f440d4b4c699494d2e972a1753cdc25df7b0"}, - {file = "black-23.12.1-cp310-cp310-win_amd64.whl", hash = "sha256:3fa4be75ef2a6b96ea8d92b1587dd8cb3a35c7e3d51f0738ced0781c3aa3a5a3"}, - {file = "black-23.12.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8d4df77958a622f9b5a4c96edb4b8c0034f8434032ab11077ec6c56ae9f384ba"}, - {file = "black-23.12.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:602cfb1196dc692424c70b6507593a2b29aac0547c1be9a1d1365f0d964c353b"}, - {file = "black-23.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4352800f14be5b4864016882cdba10755bd50805c95f728011bcb47a4afd59"}, - {file = "black-23.12.1-cp311-cp311-win_amd64.whl", hash = "sha256:0808494f2b2df923ffc5723ed3c7b096bd76341f6213989759287611e9837d50"}, - {file = "black-23.12.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:25e57fd232a6d6ff3f4478a6fd0580838e47c93c83eaf1ccc92d4faf27112c4e"}, - {file = "black-23.12.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d9e13db441c509a3763a7a3d9a49ccc1b4e974a47be4e08ade2a228876500ec"}, - {file = "black-23.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1bd9c210f8b109b1762ec9fd36592fdd528485aadb3f5849b2740ef17e674e"}, - {file = "black-23.12.1-cp312-cp312-win_amd64.whl", hash = "sha256:ae76c22bde5cbb6bfd211ec343ded2163bba7883c7bc77f6b756a1049436fbb9"}, - {file = "black-23.12.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1fa88a0f74e50e4487477bc0bb900c6781dbddfdfa32691e780bf854c3b4a47f"}, - {file = "black-23.12.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a4d6a9668e45ad99d2f8ec70d5c8c04ef4f32f648ef39048d010b0689832ec6d"}, - {file = "black-23.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b18fb2ae6c4bb63eebe5be6bd869ba2f14fd0259bda7d18a46b764d8fb86298a"}, - {file = "black-23.12.1-cp38-cp38-win_amd64.whl", hash = "sha256:c04b6d9d20e9c13f43eee8ea87d44156b8505ca8a3c878773f68b4e4812a421e"}, - {file = "black-23.12.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e1b38b3135fd4c025c28c55ddfc236b05af657828a8a6abe5deec419a0b7055"}, - {file = "black-23.12.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4f0031eaa7b921db76decd73636ef3a12c942ed367d8c3841a0739412b260a54"}, - {file = "black-23.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97e56155c6b737854e60a9ab1c598ff2533d57e7506d97af5481141671abf3ea"}, - {file = "black-23.12.1-cp39-cp39-win_amd64.whl", hash = "sha256:dd15245c8b68fe2b6bd0f32c1556509d11bb33aec9b5d0866dd8e2ed3dba09c2"}, - {file = "black-23.12.1-py3-none-any.whl", hash = "sha256:78baad24af0f033958cad29731e27363183e140962595def56423e626f4bee3e"}, - {file = "black-23.12.1.tar.gz", hash = "sha256:4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5"}, -] - -[package.dependencies] -click = ">=8.0.0" -ipython = {version = ">=7.8.0", optional = true, markers = "extra == \"jupyter\""} -mypy-extensions = ">=0.4.3" -packaging = ">=22.0" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tokenize-rt = {version = ">=3.2.0", optional = true, markers = "extra == \"jupyter\""} -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - [[package]] name = "bleach" version = "6.0.0" @@ -3801,28 +3753,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.9" +version = "0.1.15" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:e6a212f436122ac73df851f0cf006e0c6612fe6f9c864ed17ebefce0eff6a5fd"}, - {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:28d920e319783d5303333630dae46ecc80b7ba294aeffedf946a02ac0b7cc3db"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:104aa9b5e12cb755d9dce698ab1b97726b83012487af415a4512fedd38b1459e"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1e63bf5a4a91971082a4768a0aba9383c12392d0d6f1e2be2248c1f9054a20da"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4d0738917c203246f3e275b37006faa3aa96c828b284ebfe3e99a8cb413c8c4b"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:69dac82d63a50df2ab0906d97a01549f814b16bc806deeac4f064ff95c47ddf5"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2aec598fb65084e41a9c5d4b95726173768a62055aafb07b4eff976bac72a592"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:744dfe4b35470fa3820d5fe45758aace6269c578f7ddc43d447868cfe5078bcb"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:479ca4250cab30f9218b2e563adc362bd6ae6343df7c7b5a7865300a5156d5a6"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:aa8344310f1ae79af9ccd6e4b32749e93cddc078f9b5ccd0e45bd76a6d2e8bb6"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:837c739729394df98f342319f5136f33c65286b28b6b70a87c28f59354ec939b"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:e6837202c2859b9f22e43cb01992373c2dbfeae5c0c91ad691a4a2e725392464"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:331aae2cd4a0554667ac683243b151c74bd60e78fb08c3c2a4ac05ee1e606a39"}, - {file = "ruff-0.1.9-py3-none-win32.whl", hash = "sha256:8151425a60878e66f23ad47da39265fc2fad42aed06fb0a01130e967a7a064f4"}, - {file = "ruff-0.1.9-py3-none-win_amd64.whl", hash = "sha256:c497d769164df522fdaf54c6eba93f397342fe4ca2123a2e014a5b8fc7df81c7"}, - {file = "ruff-0.1.9-py3-none-win_arm64.whl", hash = "sha256:0e17f53bcbb4fff8292dfd84cf72d767b5e146f009cccd40c2fad27641f8a7a9"}, - {file = "ruff-0.1.9.tar.gz", hash = "sha256:b041dee2734719ddbb4518f762c982f2e912e7f28b8ee4fe1dee0b15d1b6e800"}, + {file = "ruff-0.1.15-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:5fe8d54df166ecc24106db7dd6a68d44852d14eb0729ea4672bb4d96c320b7df"}, + {file = "ruff-0.1.15-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6f0bfbb53c4b4de117ac4d6ddfd33aa5fc31beeaa21d23c45c6dd249faf9126f"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e0d432aec35bfc0d800d4f70eba26e23a352386be3a6cf157083d18f6f5881c8"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9405fa9ac0e97f35aaddf185a1be194a589424b8713e3b97b762336ec79ff807"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c66ec24fe36841636e814b8f90f572a8c0cb0e54d8b5c2d0e300d28a0d7bffec"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:6f8ad828f01e8dd32cc58bc28375150171d198491fc901f6f98d2a39ba8e3ff5"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86811954eec63e9ea162af0ffa9f8d09088bab51b7438e8b6488b9401863c25e"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fd4025ac5e87d9b80e1f300207eb2fd099ff8200fa2320d7dc066a3f4622dc6b"}, + {file = "ruff-0.1.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b17b93c02cdb6aeb696effecea1095ac93f3884a49a554a9afa76bb125c114c1"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ddb87643be40f034e97e97f5bc2ef7ce39de20e34608f3f829db727a93fb82c5"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:abf4822129ed3a5ce54383d5f0e964e7fef74a41e48eb1dfad404151efc130a2"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6c629cf64bacfd136c07c78ac10a54578ec9d1bd2a9d395efbee0935868bf852"}, + {file = "ruff-0.1.15-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1bab866aafb53da39c2cadfb8e1c4550ac5340bb40300083eb8967ba25481447"}, + {file = "ruff-0.1.15-py3-none-win32.whl", hash = "sha256:2417e1cb6e2068389b07e6fa74c306b2810fe3ee3476d5b8a96616633f40d14f"}, + {file = "ruff-0.1.15-py3-none-win_amd64.whl", hash = "sha256:3837ac73d869efc4182d9036b1405ef4c73d9b1f88da2413875e34e0d6919587"}, + {file = "ruff-0.1.15-py3-none-win_arm64.whl", hash = "sha256:9a933dfb1c14ec7a33cceb1e49ec4a16b51ce3c20fd42663198746efc0427360"}, + {file = "ruff-0.1.15.tar.gz", hash = "sha256:f6dfa8c1b21c913c326919056c390966648b680966febcb796cc9d1aaab8564e"}, ] [[package]] @@ -4254,17 +4206,6 @@ webencodings = ">=0.4" doc = ["sphinx", "sphinx_rtd_theme"] test = ["flake8", "isort", "pytest"] -[[package]] -name = "tokenize-rt" -version = "5.2.0" -description = "A wrapper around the stdlib `tokenize` which roundtrips." -optional = false -python-versions = ">=3.8" -files = [ - {file = "tokenize_rt-5.2.0-py2.py3-none-any.whl", hash = "sha256:b79d41a65cfec71285433511b50271b05da3584a1da144a0752e9c621a285289"}, - {file = "tokenize_rt-5.2.0.tar.gz", hash = "sha256:9fe80f8a5c1edad2d3ede0f37481cc0cc1538a2f442c9c2f9e4feacd2792d054"}, -] - [[package]] name = "tomli" version = "2.0.1" @@ -4793,4 +4734,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "~3.10" -content-hash = "34bff4248b304fff32159b7943a5f092f4ae602b2ede69a2cae9a711ad2dfd41" +content-hash = "570c562b185d7a7541cd8d70783c1bbab3c8b28815b96601ff97b6a4dd35cabc" diff --git a/pyproject.toml b/pyproject.toml index 8e17c02..4b73ec2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,8 +48,7 @@ PyYAML = "*" [tool.poetry.group.dev.dependencies] pre-commit = "^3.3.3" -black = { version = "^23.12.1", extras = ["jupyter"] } -ruff = "^0.1.9" +ruff = "^0.1.15" # Type hinting mypy = "^1.8.0" @@ -78,10 +77,6 @@ mkdocs-literate-nav = "^0.6.1" mkdocs-section-index = "^0.3.8" git-changelog = "^2.4.0" -[tool.black] -target-version = ['py310'] -line-length = 120 - [tool.mypy] python_version = "3.10" warn_return_any = true @@ -135,6 +130,12 @@ extend-exclude = [ "D103", # D103 complains when there is no docstring in a function ] +[tool.ruff.format] +# Like Black +quote-style = "double" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto" [tool.ruff.pydocstyle] convention = "google" diff --git a/requirements-dev.txt b/requirements-dev.txt index b575b3d..731bf88 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ annotated-types==0.5.0 ; python_version >= "3.10" and python_version < "3.11" anyio==3.7.1 ; python_version >= "3.10" and python_version < "3.11" appdirs==1.4.4 ; python_version >= "3.10" and python_version < "3.11" -appnope==0.1.3 ; python_version >= "3.10" and python_version < "3.11" and (sys_platform == "darwin" or platform_system == "Darwin") +appnope==0.1.3 ; python_version >= "3.10" and python_version < "3.11" and (platform_system == "Darwin" or sys_platform == "darwin") argon2-cffi-bindings==21.2.0 ; python_version >= "3.10" and python_version < "3.11" argon2-cffi==23.1.0 ; python_version >= "3.10" and python_version < "3.11" arrow==1.2.3 ; python_version >= "3.10" and python_version < "3.11" @@ -12,7 +12,6 @@ attrs==23.1.0 ; python_version >= "3.10" and python_version < "3.11" babel==2.12.1 ; python_version >= "3.10" and python_version < "3.11" backcall==0.2.0 ; python_version >= "3.10" and python_version < "3.11" beautifulsoup4==4.12.2 ; python_version >= "3.10" and python_version < "3.11" -black[jupyter]==23.12.1 ; python_version >= "3.10" and python_version < "3.11" bleach==6.0.0 ; python_version >= "3.10" and python_version < "3.11" certifi==2023.7.22 ; python_version >= "3.10" and python_version < "3.11" cffi==1.15.1 ; python_version >= "3.10" and python_version < "3.11" @@ -106,7 +105,7 @@ pre-commit==3.3.3 ; python_version >= "3.10" and python_version < "3.11" prometheus-client==0.17.1 ; python_version >= "3.10" and python_version < "3.11" prompt-toolkit==3.0.39 ; python_version >= "3.10" and python_version < "3.11" psutil==5.9.5 ; python_version >= "3.10" and python_version < "3.11" -ptyprocess==0.7.0 ; python_version >= "3.10" and python_version < "3.11" and (sys_platform != "win32" or os_name != "nt") +ptyprocess==0.7.0 ; python_version >= "3.10" and python_version < "3.11" and (os_name != "nt" or sys_platform != "win32") pure-eval==0.2.2 ; python_version >= "3.10" and python_version < "3.11" pycparser==2.21 ; python_version >= "3.10" and python_version < "3.11" pydantic-core==2.6.3 ; python_version >= "3.10" and python_version < "3.11" @@ -133,7 +132,7 @@ requests==2.31.0 ; python_version >= "3.10" and python_version < "3.11" rfc3339-validator==0.1.4 ; python_version >= "3.10" and python_version < "3.11" rfc3986-validator==0.1.1 ; python_version >= "3.10" and python_version < "3.11" rpds-py==0.9.2 ; python_version >= "3.10" and python_version < "3.11" -ruff==0.1.9 ; python_version >= "3.10" and python_version < "3.11" +ruff==0.1.15 ; python_version >= "3.10" and python_version < "3.11" semver==3.0.2 ; python_version >= "3.10" and python_version < "3.11" send2trash==1.8.2 ; python_version >= "3.10" and python_version < "3.11" setuptools==68.1.2 ; python_version >= "3.10" and python_version < "3.11" @@ -144,7 +143,6 @@ stack-data==0.6.2 ; python_version >= "3.10" and python_version < "3.11" terminado==0.17.1 ; python_version >= "3.10" and python_version < "3.11" termynal==0.11.0 ; python_version >= "3.10" and python_version < "3.11" tinycss2==1.2.1 ; python_version >= "3.10" and python_version < "3.11" -tokenize-rt==5.2.0 ; python_version >= "3.10" and python_version < "3.11" tomli==2.0.1 ; python_version >= "3.10" and python_version < "3.11" tornado==6.3.3 ; python_version >= "3.10" and python_version < "3.11" traitlets==5.9.0 ; python_version >= "3.10" and python_version < "3.11" From fc557edc28eded107b15c359a405661674f2dac8 Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 11:55:39 +0000 Subject: [PATCH 2/6] Drop Black badge --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 64363dc..50c0c81 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Docker](https://badgen.net/badge/icon/docker?icon=docker&label)](https://docker.com/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) [![pydocstyle](https://img.shields.io/badge/pydocstyle-enabled-AD4CD3)](http://www.pydocstyle.org/en/stable/) From 4cf29b440f280afc094be4d23243c240ec3c8a89 Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 11:55:56 +0000 Subject: [PATCH 3/6] Use new Ruff badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50c0c81..d69ea52 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) [![Docker](https://badgen.net/badge/icon/docker?icon=docker&label)](https://docker.com/) -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) [![pydocstyle](https://img.shields.io/badge/pydocstyle-enabled-AD4CD3)](http://www.pydocstyle.org/en/stable/) From b9f6354a06ffe705839abe004b077199ec54ff6b Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 12:01:01 +0000 Subject: [PATCH 4/6] Delete mentions of Black --- .vscode/settings.json | 5 ----- docs/tooling/pipelines.md | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c7f1a61..59ffec8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,11 +15,6 @@ "--ignore=E712,W503" ], - "python.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--line-length 120" - ], - "[python]": { "editor.formatOnSave": true, "editor.codeActionsOnSave": { diff --git a/docs/tooling/pipelines.md b/docs/tooling/pipelines.md index 6f4f6f6..77a7351 100644 --- a/docs/tooling/pipelines.md +++ b/docs/tooling/pipelines.md @@ -4,7 +4,7 @@ Several pipelines are included to execute automatically on various triggers: | What | When | How | |--------------------------------------------------|--------------------------------------|-----------------------| -| Check code with `black`, `ruff`, and `mypy` | On PR creation and subsequent pushes | [quality-check.yml] | +| Check code with `ruff` and `mypy` | On PR creation and subsequent pushes | [quality-check.yml] | | Unit test with `pytest` | On PR creation and subsequent pushes | [test.yml] | | Build the API documentation | On the creation of a new release | [api-docs.yml] | | Check for dependency updates and vulnerabilities | On a schedule (check the file) | [dependabot.yml] | From 34cf1258735b805279bf1bfbb237348a68cf3d43 Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 12:01:14 +0000 Subject: [PATCH 5/6] Update docs to replace Black with ruff formatter --- docs/tooling/quality.md | 41 ++++++++++------------------------------ pycharm/watchers.xml | 42 ----------------------------------------- 2 files changed, 10 insertions(+), 73 deletions(-) delete mode 100644 pycharm/watchers.xml diff --git a/docs/tooling/quality.md b/docs/tooling/quality.md index 2191db5..56fb949 100644 --- a/docs/tooling/quality.md +++ b/docs/tooling/quality.md @@ -22,45 +22,27 @@ To automatically fix any issues, run ruff --fix my_project/ tests/ ``` -### PyCharm integration - -You can also install the [Ruff plugin for PyCharm] to run it automatically on file changes. In **Preferences** | -**Tools** | **Ruff**, configure it as you like. - -To aid in documentation, in PyCharm go to **Preferences** | **Tools** | **Python Integrated Tools**. Under -**Docstrings**, select the docstring format as Google. - -## Black - -[Black] is a widely-used tool to ensure consistently-formatted code. +Ruff now contains a formatter to replace [Black]. It ensures consistently-formatted, highly readable code. -To automatically reformat your code, run +To automatically format your code, run ```shell -black my_project/ tests/ +ruff format my_project/ tests/ ``` -To instead just show what `black` would change, run +To instead just show what `ruff` would change, run ```shell -black --diff my_project/ tests/ +ruff format --diff my_project/ tests/ ``` ### PyCharm integration -`black` is integrated into PyCharm as of v2023.2. Go to **Settings** | **Tools** | **Black** to configure. - -??? tip "For older versions" - - PyCharm supports file watchers, which automatically run a command when a file is saved. This is useful for - transparently formatting code. - - To include `black` as a file watcher, go to **Settings** | **Tools** | **File Watchers** and import the - [watchers.xml]. This will automatically apply formatting to Python files and Jupyter notebooks. You may need to - edit the **Program** path to point to your `black` executable. +You can also install the [Ruff plugin for PyCharm] to run it automatically on file changes. In **Preferences** | +**Tools** | **Ruff**, configure it as you like. -Otherwise, to set it up yourself, follow the instructions -at . +To aid in documentation, in PyCharm go to **Preferences** | **Tools** | **Python Integrated Tools**. Under +**Docstrings**, select the docstring format as Google. ## Mypy @@ -112,8 +94,7 @@ The [.pre-commit-config.yaml] file contains hooks to run - built-in `pre-commit` checks - Automatic use of the walrus operator -- `ruff` for linting (fixes fixable issues) -- `black` for formatting (fixes fixable issues) +- `ruff` for linting and formatting (fixes fixable issues) - `mypy` type-hinting errors - `poetry` dependency status (`poetry.lock` and requirements files are up-to-date) @@ -132,8 +113,6 @@ pre-commit run -a [pyproject.toml]: https://github.com/eshwen/ds-python-boilerplate/blob/main/pyproject.toml -[watchers.xml]: https://github.com/eshwen/ds-python-boilerplate/blob/main/pycharm/watchers.xml - [pre-commit]: https://pre-commit.com/ [Ruff]: https://beta.ruff.rs/docs/ diff --git a/pycharm/watchers.xml b/pycharm/watchers.xml deleted file mode 100644 index 21f0793..0000000 --- a/pycharm/watchers.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - From 2e6c40272aeb3227ee95ec13063e2fa418877060 Mon Sep 17 00:00:00 2001 From: "Eshwen Bhal, PhD" Date: Tue, 30 Jan 2024 12:08:28 +0000 Subject: [PATCH 6/6] Use new version of adrenaline Which replaces Black with Ruff format --- .github/workflows/api-docs.yml | 2 +- .github/workflows/quality-check.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml index 4c77e4e..61fc29e 100644 --- a/.github/workflows/api-docs.yml +++ b/.github/workflows/api-docs.yml @@ -15,7 +15,7 @@ jobs: contents: 'write' actions: 'write' - uses: eshwen/adrenaline/.github/workflows/api-docs-build.yml@v0.2.5 + uses: eshwen/adrenaline/.github/workflows/api-docs-build.yml@v0.3.0 with: python-version: '3.10' changelog: 'CHANGELOG.md' diff --git a/.github/workflows/quality-check.yml b/.github/workflows/quality-check.yml index 9add0e7..20a52e8 100644 --- a/.github/workflows/quality-check.yml +++ b/.github/workflows/quality-check.yml @@ -14,7 +14,7 @@ concurrency: jobs: lint: - uses: eshwen/adrenaline/.github/workflows/python-quality-check.yml@v0.2.5 + uses: eshwen/adrenaline/.github/workflows/python-quality-check.yml@v0.3.0 with: python-version: '3.10' path: 'my_project/' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f914e25..3bbe700 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - name: Test - uses: eshwen/adrenaline/test-python@v0.2.5 + uses: eshwen/adrenaline/test-python@v0.3.0 with: python-version: '3.10' path: 'my_project/'