From b86d8e7bb9904e389812cac6f64778941e679f2e Mon Sep 17 00:00:00 2001 From: Patrick ZAJDA Date: Thu, 16 Jan 2025 17:48:06 +0100 Subject: [PATCH] Replace extra-dependencies by dependency groups (#598) * Use PEP 735 groups instead of extra-dependencies in pyproject.toml Doc, test and CI dependencies are not useful for published package. CI includes doc group with hatch-vcs when publishing documentation. Signed-off-by: Patrick ZAJDA * Update workflows to use dependencies groups Signed-off-by: Patrick ZAJDA --------- Signed-off-by: Patrick ZAJDA --- .github/workflows/actions.yml | 6 +++--- .github/workflows/release.yml | 2 +- pyproject.toml | 3 ++- uv.lock | 38 +++++++++++++++++++++++------------ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 29c015d..dab6eb0 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -41,7 +41,7 @@ jobs: cache-suffix: lint - name: 📦 Install dependencies - run: uv sync --frozen --extra lint + run: uv sync --frozen --group lint - name: Pre-commit cache uses: actions/cache@v4.2.0 @@ -76,7 +76,7 @@ jobs: run: uv python install ${{ matrix.python-version }} - name: 📦 Install dependencies - run: uv sync --frozen --extra test + run: uv sync --frozen --group test - name: 🏃 Run tests run: uv run pytest tests @@ -152,7 +152,7 @@ jobs: id: python - name: 📦 Install dependencies - run: uv sync --frozen --extra doc + run: uv sync --frozen --group doc - name: Build documentation using sphinx run: uv run make -C docs html diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6ab505..59b431d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: id: python - name: 📦 Install dependencies - run: uv sync --frozen --extra doc --extra ci + run: uv sync --frozen --group ci - name: Get version id: get-version diff --git a/pyproject.toml b/pyproject.toml index 0ac77fa..ae897e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "aiohttp>=3.8.0,<4.0", ] -[project.optional-dependencies] +[dependency-groups] doc = [ "Sphinx==8.1.3", "furo==2024.8.6", @@ -51,6 +51,7 @@ test = [ "pytest-cov==6.0.0", ] ci = [ + {include-group = "doc"}, "hatch-vcs==0.4.0" ] diff --git a/uv.lock b/uv.lock index bdc7fc6..9a42279 100644 --- a/uv.lock +++ b/uv.lock @@ -841,9 +841,11 @@ dependencies = [ { name = "aiohttp" }, ] -[package.optional-dependencies] +[package.dev-dependencies] ci = [ + { name = "furo" }, { name = "hatch-vcs" }, + { name = "sphinx" }, ] doc = [ { name = "furo" }, @@ -862,18 +864,28 @@ test = [ ] [package.metadata] -requires-dist = [ - { name = "aiohttp", specifier = ">=3.8.0,<4.0" }, - { name = "aresponses", marker = "extra == 'test'", specifier = "==3.0.0" }, - { name = "coverage", marker = "extra == 'test'", specifier = "==7.6.10" }, - { name = "furo", marker = "extra == 'doc'", specifier = "==2024.8.6" }, - { name = "hatch-vcs", marker = "extra == 'ci'", specifier = "==0.4.0" }, - { name = "mypy", marker = "extra == 'lint'", specifier = "==1.14.1" }, - { name = "pre-commit", marker = "extra == 'lint'", specifier = "==4.0.1" }, - { name = "pytest", marker = "extra == 'test'", specifier = "==8.3.4" }, - { name = "pytest-asyncio", marker = "extra == 'test'", specifier = "==0.25.2" }, - { name = "pytest-cov", marker = "extra == 'test'", specifier = "==6.0.0" }, - { name = "sphinx", marker = "extra == 'doc'", specifier = "==8.1.3" }, +requires-dist = [{ name = "aiohttp", specifier = ">=3.8.0,<4.0" }] + +[package.metadata.requires-dev] +ci = [ + { name = "furo", specifier = "==2024.8.6" }, + { name = "hatch-vcs", specifier = "==0.4.0" }, + { name = "sphinx", specifier = "==8.1.3" }, +] +doc = [ + { name = "furo", specifier = "==2024.8.6" }, + { name = "sphinx", specifier = "==8.1.3" }, +] +lint = [ + { name = "mypy", specifier = "==1.14.1" }, + { name = "pre-commit", specifier = "==4.0.1" }, +] +test = [ + { name = "aresponses", specifier = "==3.0.0" }, + { name = "coverage", specifier = "==7.6.10" }, + { name = "pytest", specifier = "==8.3.4" }, + { name = "pytest-asyncio", specifier = "==0.25.2" }, + { name = "pytest-cov", specifier = "==6.0.0" }, ] [[package]]