From babf43d270fbedc8f7cbea2bd44ec2afb2d9d6dc Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 17:46:05 +0100 Subject: [PATCH 1/6] dep groups update --- .github/workflows/lint.yml | 33 +++++++++++++++++++++++++++++++-- .github/workflows/test.yml | 2 +- pyproject.toml | 9 +++------ uv.lock | 16 ++++++---------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00af7b0..fb1279c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,6 +7,35 @@ concurrency: cancel-in-progress: true jobs: + ruff: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/ruff-action@v3 + with: + args: check --no-fix + + - uses: astral-sh/ruff-action@v3 + with: + args: format --diff + + mypy: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync + + - name: Run MyPy + run: uv run mypy + pre-commit: runs-on: ubuntu-24.04 steps: @@ -18,7 +47,7 @@ jobs: enable-cache: true - name: Install dependencies - run: uv sync --no-install-project --group lint + run: uv sync --only-dev - name: Cache pre-commit uses: actions/cache@v4 @@ -27,4 +56,4 @@ jobs: key: precommit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit - run: make fmt + run: SKIP="ruff,ruff-format,mypy" uv run pre-commit run --all-files diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0bb9fa1..9a04723 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: enable-cache: true - name: Install dependencies - run: uv sync --group test + run: uv sync - name: Run tests and generate coverage report run: make coverage diff --git a/pyproject.toml b/pyproject.toml index 50438ed..0537cf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,14 +16,12 @@ dependencies = [ mycli = 'mypackage.__main__:main' [dependency-groups] -test = [ +dev = [ "coverage>=7.6.10", - "pytest>=8.3.4", - "pytest-mock>=3.14.0", -] -lint = [ "mypy>=1.14.1", "pre-commit>=4.1.0", + "pytest>=8.3.4", + "pytest-mock>=3.14.0", "ruff>=0.9.4", ] @@ -33,7 +31,6 @@ build-backend = "hatchling.build" [tool.uv] required-version = ">=0.5,<0.6" -default-groups = ["test", "lint"] [tool.ruff] src = ["src"] diff --git a/uv.lock b/uv.lock index 5953600..5060357 100644 --- a/uv.lock +++ b/uv.lock @@ -112,30 +112,26 @@ dependencies = [ ] [package.dev-dependencies] -lint = [ +dev = [ + { name = "coverage" }, { name = "mypy" }, { name = "pre-commit" }, - { name = "ruff" }, -] -test = [ - { name = "coverage" }, { name = "pytest" }, { name = "pytest-mock" }, + { name = "ruff" }, ] [package.metadata] requires-dist = [{ name = "polars", specifier = ">=1.21.0" }] [package.metadata.requires-dev] -lint = [ +dev = [ + { name = "coverage", specifier = ">=7.6.10" }, { name = "mypy", specifier = ">=1.14.1" }, { name = "pre-commit", specifier = ">=4.1.0" }, - { name = "ruff", specifier = ">=0.9.4" }, -] -test = [ - { name = "coverage", specifier = ">=7.6.10" }, { name = "pytest", specifier = ">=8.3.4" }, { name = "pytest-mock", specifier = ">=3.14.0" }, + { name = "ruff", specifier = ">=0.9.4" }, ] [[package]] From a2e3da0424135709c061b7266b413d5e274c04ac Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 17:49:23 +0100 Subject: [PATCH 2/6] uv version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0537cf6..d165af5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.uv] -required-version = ">=0.5,<0.6" +required-version = ">=0.5" [tool.ruff] src = ["src"] From 5c2bfec075b6aa8ca91864ba0a9ce5787f313372 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 17:55:17 +0100 Subject: [PATCH 3/6] uv max version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d165af5..c174972 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.uv] -required-version = ">=0.5" +required-version = "<0.6" [tool.ruff] src = ["src"] From 3f46a9a3163dcbd564af1b7eae10640a5fdeceb3 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 17:58:34 +0100 Subject: [PATCH 4/6] Add TODO --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c174972..3679aa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,8 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.uv] +# TODO: Set to ">=0.5,<0.6" when bug is fixed +# https://github.com/astral-sh/setup-uv/issues/264 required-version = "<0.6" [tool.ruff] From 4d8ccb9f60c3e318488e29bae583dd9d4db7a330 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 18:00:36 +0100 Subject: [PATCH 5/6] Update readme --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 663006f..a7592b3 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,9 @@ Simply run `make` to get an overview of available commands. [uv](https://docs.astral.sh/uv/) is an amazing, modern tool for developing Python packages. -Note that the dependency specification for this repository contains two [dependency groups](https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups): - -- `test`: Includes all testing dependencies. -- `lint`: Includes all linting dependencies. This can be useful to help your IDE do autoformatting or show in-line linting errors. - -Having these development dependencies in separate groups makes it easy to install only the required dependencies in the CI workflows. +Note that the dependency specification for this repository contains a single `dev` [dependency group](https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups). +With the speed that uv offers, it's not really required to further split this out into a `test` and `lint` group, for example. +Furthermore, using `dev` is the default and this offers some minor integration benefits. ## GitHub Actions From 6934575d9305e117e0a833fccd3239944aa90dc0 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Fri, 31 Jan 2025 18:01:55 +0100 Subject: [PATCH 6/6] Restore precommit --- .github/workflows/lint.yml | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fb1279c..69f52c1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,35 +7,6 @@ concurrency: cancel-in-progress: true jobs: - ruff: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - - uses: astral-sh/ruff-action@v3 - with: - args: check --no-fix - - - uses: astral-sh/ruff-action@v3 - with: - args: format --diff - - mypy: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - - - name: Install dependencies - run: uv sync - - - name: Run MyPy - run: uv run mypy - pre-commit: runs-on: ubuntu-24.04 steps: @@ -56,4 +27,4 @@ jobs: key: precommit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit - run: SKIP="ruff,ruff-format,mypy" uv run pre-commit run --all-files + run: uv run pre-commit run --all-files