From 84c27ff16cfaa05a1805a5494dbc8f0072572132 Mon Sep 17 00:00:00 2001 From: Eric Rodrigues Pires Date: Wed, 22 Oct 2025 22:57:54 -0300 Subject: [PATCH] Add RUff to CI --- .github/workflows/validate.yaml | 35 ++++++++++++++++++++++++--------- duper-python/pyproject.toml | 1 + duper-python/src/lib.rs | 4 ---- duper-python/uv.lock | 28 ++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index f0ea93a..a907baa 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -16,7 +16,7 @@ env: PYTHON_MINIMUM_VERSION: "3.10" jobs: - rustfmt-msrv: + rustfmt: name: Check rustfmt formatting on MSRV runs-on: ubuntu-latest steps: @@ -32,7 +32,22 @@ jobs: run: | rustup component add rustfmt cargo fmt --check --all - build-msrv: + ruff: + name: Check Ruff formatting on minimum Python version + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - name: Run ruff + uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1 + with: + src: >- + duper-python/examples + duper-python/tests + duper-python/python/duper + build-rust: name: Build on MSRV runs-on: ubuntu-latest steps: @@ -49,8 +64,8 @@ jobs: - name: Build run: | cargo build --locked --all-features - tests-nightly: - name: Run tests on MSRV + test: + name: Run tests runs-on: ubuntu-latest steps: - name: Checkout repository @@ -67,11 +82,13 @@ jobs: python-version: ${{ env.PYTHON_MINIMUM_VERSION }} - name: Cache Rust dependencies uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - - name: Install just - run: | - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to . - - name: Test + - name: Test Rust env: RUSTFLAGS: -A dead_code -A unused_variables run: | - ./just test + cargo test --all-features + - name: Test Python + working-directory: duper-python + run: | + uv run maturin develop + uv run pytest -vv diff --git a/duper-python/pyproject.toml b/duper-python/pyproject.toml index cf4843d..dd39c1c 100644 --- a/duper-python/pyproject.toml +++ b/duper-python/pyproject.toml @@ -34,5 +34,6 @@ dev = [ "httpx>=0.28.1", "maturin>=1.9.6", "pytest>=8.4.2", + "ruff>=0.14.1", "starlette>=0.48.0", ] diff --git a/duper-python/src/lib.rs b/duper-python/src/lib.rs index 592ed59..07cc8bd 100644 --- a/duper-python/src/lib.rs +++ b/duper-python/src/lib.rs @@ -12,7 +12,6 @@ mod duper_py { use crate::{de::Visitor, ser::serialize_pyany}; - #[allow(clippy::declare_interior_mutable_const)] #[pyfunction] #[pyo3(signature = (obj, *, indent=None, strip_identifiers=false))] fn dumps<'py>( @@ -45,7 +44,6 @@ mod duper_py { } } - #[allow(clippy::declare_interior_mutable_const)] #[pyfunction] #[pyo3(signature = (obj, fp, *, indent=None, strip_identifiers=false))] fn dump<'py>( @@ -83,7 +81,6 @@ mod duper_py { Ok(()) } - #[allow(clippy::declare_interior_mutable_const)] #[pyfunction] #[pyo3(signature = (s, *, parse_any=false))] fn loads<'py>(py: Python<'py>, s: &str, parse_any: bool) -> PyResult> { @@ -100,7 +97,6 @@ mod duper_py { value.accept(&mut Visitor { py }) } - #[allow(clippy::declare_interior_mutable_const)] #[pyfunction] #[pyo3(signature = (fp, *, parse_any=false))] fn load<'py>( diff --git a/duper-python/uv.lock b/duper-python/uv.lock index 93c5eed..d94b7c8 100644 --- a/duper-python/uv.lock +++ b/duper-python/uv.lock @@ -75,6 +75,7 @@ dev = [ { name = "httpx" }, { name = "maturin" }, { name = "pytest" }, + { name = "ruff" }, { name = "starlette" }, ] @@ -86,6 +87,7 @@ dev = [ { name = "httpx", specifier = ">=0.28.1" }, { name = "maturin", specifier = ">=1.9.6" }, { name = "pytest", specifier = ">=8.4.2" }, + { name = "ruff", specifier = ">=0.14.1" }, { name = "starlette", specifier = ">=0.48.0" }, ] @@ -800,6 +802,32 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/65/73/abf94b0697d8ca7aa953dacc2378bdaffb9f20b95316f5af07fcf9c9bb0b/rignore-0.7.1-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:dd87a68eee7aefc0d51d1a69dc8448b2ab1de8666da0bd6013e87b4a2ae71852", size = 1119460 }, ] +[[package]] +name = "ruff" +version = "0.14.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9e/58/6ca66896635352812de66f71cdf9ff86b3a4f79071ca5730088c0cd0fc8d/ruff-0.14.1.tar.gz", hash = "sha256:1dd86253060c4772867c61791588627320abcb6ed1577a90ef432ee319729b69", size = 5513429 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8d/39/9cc5ab181478d7a18adc1c1e051a84ee02bec94eb9bdfd35643d7c74ca31/ruff-0.14.1-py3-none-linux_armv6l.whl", hash = "sha256:083bfc1f30f4a391ae09c6f4f99d83074416b471775b59288956f5bc18e82f8b", size = 12445415 }, + { url = "https://files.pythonhosted.org/packages/ef/2e/1226961855ccd697255988f5a2474890ac7c5863b080b15bd038df820818/ruff-0.14.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:f6fa757cd717f791009f7669fefb09121cc5f7d9bd0ef211371fad68c2b8b224", size = 12784267 }, + { url = "https://files.pythonhosted.org/packages/c1/ea/fd9e95863124ed159cd0667ec98449ae461de94acda7101f1acb6066da00/ruff-0.14.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d6191903d39ac156921398e9c86b7354d15e3c93772e7dbf26c9fcae59ceccd5", size = 11781872 }, + { url = "https://files.pythonhosted.org/packages/1e/5a/e890f7338ff537dba4589a5e02c51baa63020acfb7c8cbbaea4831562c96/ruff-0.14.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed04f0e04f7a4587244e5c9d7df50e6b5bf2705d75059f409a6421c593a35896", size = 12226558 }, + { url = "https://files.pythonhosted.org/packages/a6/7a/8ab5c3377f5bf31e167b73651841217542bcc7aa1c19e83030835cc25204/ruff-0.14.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5c9e6cf6cd4acae0febbce29497accd3632fe2025c0c583c8b87e8dbdeae5f61", size = 12187898 }, + { url = "https://files.pythonhosted.org/packages/48/8d/ba7c33aa55406955fc124e62c8259791c3d42e3075a71710fdff9375134f/ruff-0.14.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a6fa2458527794ecdfbe45f654e42c61f2503a230545a91af839653a0a93dbc6", size = 12939168 }, + { url = "https://files.pythonhosted.org/packages/b4/c2/70783f612b50f66d083380e68cbd1696739d88e9b4f6164230375532c637/ruff-0.14.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:39f1c392244e338b21d42ab29b8a6392a722c5090032eb49bb4d6defcdb34345", size = 14386942 }, + { url = "https://files.pythonhosted.org/packages/48/44/cd7abb9c776b66d332119d67f96acf15830d120f5b884598a36d9d3f4d83/ruff-0.14.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7382fa12a26cce1f95070ce450946bec357727aaa428983036362579eadcc5cf", size = 13990622 }, + { url = "https://files.pythonhosted.org/packages/eb/56/4259b696db12ac152fe472764b4f78bbdd9b477afd9bc3a6d53c01300b37/ruff-0.14.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd0bf2be3ae8521e1093a487c4aa3b455882f139787770698530d28ed3fbb37c", size = 13431143 }, + { url = "https://files.pythonhosted.org/packages/e0/35/266a80d0eb97bd224b3265b9437bd89dde0dcf4faf299db1212e81824e7e/ruff-0.14.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cabcaa9ccf8089fb4fdb78d17cc0e28241520f50f4c2e88cb6261ed083d85151", size = 13132844 }, + { url = "https://files.pythonhosted.org/packages/65/6e/d31ce218acc11a8d91ef208e002a31acf315061a85132f94f3df7a252b18/ruff-0.14.1-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:747d583400f6125ec11a4c14d1c8474bf75d8b419ad22a111a537ec1a952d192", size = 13401241 }, + { url = "https://files.pythonhosted.org/packages/9f/b5/dbc4221bf0b03774b3b2f0d47f39e848d30664157c15b965a14d890637d2/ruff-0.14.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:5a6e74c0efd78515a1d13acbfe6c90f0f5bd822aa56b4a6d43a9ffb2ae6e56cd", size = 12132476 }, + { url = "https://files.pythonhosted.org/packages/98/4b/ac99194e790ccd092d6a8b5f341f34b6e597d698e3077c032c502d75ea84/ruff-0.14.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0ea6a864d2fb41a4b6d5b456ed164302a0d96f4daac630aeba829abfb059d020", size = 12139749 }, + { url = "https://files.pythonhosted.org/packages/47/26/7df917462c3bb5004e6fdfcc505a49e90bcd8a34c54a051953118c00b53a/ruff-0.14.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:0826b8764f94229604fa255918d1cc45e583e38c21c203248b0bfc9a0e930be5", size = 12544758 }, + { url = "https://files.pythonhosted.org/packages/64/d0/81e7f0648e9764ad9b51dd4be5e5dac3fcfff9602428ccbae288a39c2c22/ruff-0.14.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cbc52160465913a1a3f424c81c62ac8096b6a491468e7d872cb9444a860bc33d", size = 13221811 }, + { url = "https://files.pythonhosted.org/packages/c3/07/3c45562c67933cc35f6d5df4ca77dabbcd88fddaca0d6b8371693d29fd56/ruff-0.14.1-py3-none-win32.whl", hash = "sha256:e037ea374aaaff4103240ae79168c0945ae3d5ae8db190603de3b4012bd1def6", size = 12319467 }, + { url = "https://files.pythonhosted.org/packages/02/88/0ee4ca507d4aa05f67e292d2e5eb0b3e358fbcfe527554a2eda9ac422d6b/ruff-0.14.1-py3-none-win_amd64.whl", hash = "sha256:59d599cdff9c7f925a017f6f2c256c908b094e55967f93f2821b1439928746a1", size = 13401123 }, + { url = "https://files.pythonhosted.org/packages/b8/81/4b6387be7014858d924b843530e1b2a8e531846807516e9bea2ee0936bf7/ruff-0.14.1-py3-none-win_arm64.whl", hash = "sha256:e3b443c4c9f16ae850906b8d0a707b2a4c16f8d2f0a7fe65c475c5886665ce44", size = 12436636 }, +] + [[package]] name = "sentry-sdk" version = "2.42.0" -- 2.51.2