From 52bef7dcd1b83855d3bb501028471bbe9e5b0acf Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sun, 24 Nov 2024 23:00:23 +0100 Subject: [PATCH] :recycle: Refactor CI workflow and dependency management; unify optional dependencies under 'all' and 'extra' --- .github/workflows/ci.yml | 9 +----- pyproject.toml | 5 ++-- uv.lock | 61 +++++++++++++++------------------------- 3 files changed, 25 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7a2f83..8070c5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,6 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - python-version: ['3.12'] - steps: - uses: actions/checkout@v4 @@ -27,7 +24,7 @@ jobs: enable-cache: true - name: Install dependencies - run: uv sync --python ${{ matrix.python-version }} --group lint --all-extras + run: uv sync --python 3.12 --group lint --all-extras - uses: pre-commit/action@v3.0.0 with: @@ -54,9 +51,6 @@ jobs: with: enable-cache: true - - name: Install extra dependencies - run: uv sync --group dev --all-extras - - name: Make coverage directory run: mkdir coverage @@ -103,7 +97,6 @@ jobs: jobs: ${{ toJSON(needs) }} release: - name: Deploy needs: [check] if: "success() && startsWith(github.ref, 'refs/tags/')" runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index a73aa3f..8192da1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dependencies = ['pydantic>=2.5.2','typing-extensions'] dynamic = ['version'] [project.optional-dependencies] -extra = [ +all = [ 'phonenumbers>=8,<9', 'pycountry>=23', 'semver>=3.0.2', @@ -69,7 +69,6 @@ dev = [ "pytest-pretty>=1.2.0", "dirty-equals>=0.7.1", "pytest>=8.3.2", - "pytest-cov>=5.0.0", ] lint = [ "ruff>=0.7.4", @@ -77,7 +76,7 @@ lint = [ "annotated-types>=0.7.0", "types-pytz>=2024.1.0.20240417", ] -all = [ +extra = [ { include-group = 'dev' }, { include-group = 'lint' }, ] diff --git a/uv.lock b/uv.lock index e63af38..d8ad2db 100644 --- a/uv.lock +++ b/uv.lock @@ -485,7 +485,7 @@ dependencies = [ ] [package.optional-dependencies] -extra = [ +all = [ { name = "pendulum" }, { name = "phonenumbers" }, { name = "pycountry" }, @@ -511,23 +511,21 @@ semver = [ ] [package.dev-dependencies] -all = [ - { name = "annotated-types" }, +dev = [ { name = "coverage", extra = ["toml"] }, { name = "dirty-equals" }, - { name = "mypy" }, { name = "pytest" }, - { name = "pytest-cov" }, { name = "pytest-pretty" }, - { name = "ruff" }, - { name = "types-pytz" }, ] -dev = [ +extra = [ + { name = "annotated-types" }, { name = "coverage", extra = ["toml"] }, { name = "dirty-equals" }, + { name = "mypy" }, { name = "pytest" }, - { name = "pytest-cov" }, { name = "pytest-pretty" }, + { name = "ruff" }, + { name = "types-pytz" }, ] lint = [ { name = "annotated-types" }, @@ -538,43 +536,41 @@ lint = [ [package.metadata] requires-dist = [ - { name = "pendulum", marker = "extra == 'extra'", specifier = ">=3.0.0,<4.0.0" }, + { name = "pendulum", marker = "extra == 'all'", specifier = ">=3.0.0,<4.0.0" }, { name = "pendulum", marker = "extra == 'pendulum'", specifier = ">=3.0.0,<4.0.0" }, - { name = "phonenumbers", marker = "extra == 'extra'", specifier = ">=8,<9" }, + { name = "phonenumbers", marker = "extra == 'all'", specifier = ">=8,<9" }, { name = "phonenumbers", marker = "extra == 'phonenumbers'", specifier = ">=8,<9" }, - { name = "pycountry", marker = "extra == 'extra'", specifier = ">=23" }, + { name = "pycountry", marker = "extra == 'all'", specifier = ">=23" }, { name = "pycountry", marker = "extra == 'pycountry'", specifier = ">=23" }, { name = "pydantic", specifier = ">=2.5.2" }, - { name = "python-ulid", marker = "python_full_version >= '3.9' and extra == 'extra'", specifier = ">=1,<4" }, + { name = "python-ulid", marker = "python_full_version >= '3.9' and extra == 'all'", specifier = ">=1,<4" }, { name = "python-ulid", marker = "python_full_version >= '3.9' and extra == 'python-ulid'", specifier = ">=1,<4" }, - { name = "python-ulid", marker = "python_full_version < '3.9' and extra == 'extra'", specifier = ">=1,<2" }, + { name = "python-ulid", marker = "python_full_version < '3.9' and extra == 'all'", specifier = ">=1,<2" }, { name = "python-ulid", marker = "python_full_version < '3.9' and extra == 'python-ulid'", specifier = ">=1,<2" }, - { name = "pytz", marker = "extra == 'extra'", specifier = ">=2024.1" }, - { name = "semver", marker = "extra == 'extra'", specifier = "~=3.0.2" }, - { name = "semver", marker = "extra == 'extra'", specifier = ">=3.0.2" }, + { name = "pytz", marker = "extra == 'all'", specifier = ">=2024.1" }, + { name = "semver", marker = "extra == 'all'", specifier = "~=3.0.2" }, + { name = "semver", marker = "extra == 'all'", specifier = ">=3.0.2" }, { name = "semver", marker = "extra == 'semver'", specifier = ">=3.0.2" }, { name = "typing-extensions" }, - { name = "tzdata", marker = "extra == 'extra'", specifier = ">=2024.1" }, + { name = "tzdata", marker = "extra == 'all'", specifier = ">=2024.1" }, ] [package.metadata.requires-dev] -all = [ - { name = "annotated-types", specifier = ">=0.7.0" }, +dev = [ { name = "coverage", extras = ["toml"], specifier = ">=7.6.1" }, { name = "dirty-equals", specifier = ">=0.7.1" }, - { name = "mypy", specifier = ">=0.910" }, { name = "pytest", specifier = ">=8.3.2" }, - { name = "pytest-cov", specifier = ">=5.0.0" }, { name = "pytest-pretty", specifier = ">=1.2.0" }, - { name = "ruff", specifier = ">=0.7.4" }, - { name = "types-pytz", specifier = ">=2024.1.0.20240417" }, ] -dev = [ +extra = [ + { name = "annotated-types", specifier = ">=0.7.0" }, { name = "coverage", extras = ["toml"], specifier = ">=7.6.1" }, { name = "dirty-equals", specifier = ">=0.7.1" }, + { name = "mypy", specifier = ">=0.910" }, { name = "pytest", specifier = ">=8.3.2" }, - { name = "pytest-cov", specifier = ">=5.0.0" }, { name = "pytest-pretty", specifier = ">=1.2.0" }, + { name = "ruff", specifier = ">=0.7.4" }, + { name = "types-pytz", specifier = ">=2024.1.0.20240417" }, ] lint = [ { name = "annotated-types", specifier = ">=0.7.0" }, @@ -609,19 +605,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2", size = 342341 }, ] -[[package]] -name = "pytest-cov" -version = "5.0.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "coverage", extra = ["toml"] }, - { name = "pytest" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/74/67/00efc8d11b630c56f15f4ad9c7f9223f1e5ec275aaae3fa9118c6a223ad2/pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857", size = 63042 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/78/3a/af5b4fa5961d9a1e6237b530eb87dd04aea6eb83da09d2a4073d81b54ccf/pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652", size = 21990 }, -] - [[package]] name = "pytest-pretty" version = "1.2.0"