diff --git a/pyproject.toml b/pyproject.toml index 63229986f..47160bae9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ # Ref: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ # and https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html [build-system] -requires = ["setuptools >= 75.3.0, < 83.0.0", "wheel ~= 0.42"] +requires = ["setuptools >= 75.3.0, < 84.0.0", "wheel ~= 0.42"] build-backend = "setuptools.build_meta" [project] @@ -27,17 +27,23 @@ authors = [ { name = "codejedi365", email = "codejedi365@gmail.com" }, ] dependencies = [ - "click >= 8.1.0, < 9.0.0", - "click-option-group ~= 0.5", + "click ~= 8.1.0; python_version == '3.8'", + "click ~= 8.1.0; python_version == '3.9'", + "click ~= 8.1.0, < 8.5.0; python_version >= '3.10'", + "click-option-group ~= 0.5.0", "gitpython ~= 3.0", "requests ~= 2.25", "jinja2 ~= 3.1", - "python-gitlab >= 4.0.0, < 9.0.0", - "tomlkit ~= 0.13.0", + "python-gitlab ~= 4.0; python_version == '3.8'", + "python-gitlab >= 4.0.0, < 7.0.0; python_version == '3.9'", + "python-gitlab >= 4.0.0, < 9.0.0; python_version >= '3.10'", + "tomlkit ~= 0.13.0; python_version == '3.8'", + "tomlkit ~= 0.15.0; python_version >= '3.9'", "dotty-dict ~= 1.3", - "importlib-resources ~= 6.0", + "importlib-resources ~= 6.0; python_version == '3.8'", # add backport for Python 3.8 "pydantic ~= 2.0", - "rich ~= 14.0", + "rich ~= 14.0; python_version == '3.8'", + "rich ~= 15.0; python_version >= '3.9'", "shellingham ~= 1.5", "Deprecated ~= 1.2", # Backport of deprecated decorator for python 3.8 ] @@ -57,7 +63,8 @@ repository = "http://github.com/python-semantic-release/python-semantic-release. [project.optional-dependencies] build = [ "build ~= 1.2", - "tomlkit ~= 0.13.0", + "tomlkit ~= 0.13.0; python_version == '3.8'", + "tomlkit ~= 0.15.0; python_version >= '3.9'", ] docs = [ "Sphinx ~= 7.4", @@ -91,7 +98,7 @@ dev = [ mypy = [ "mypy >= 1.14.1, < 2.0.0", "types-Deprecated ~= 1.2", - "types-requests ~= 2.32.0", + "types-requests >= 2.32.0, < 3.0.0", "types-pyyaml ~= 6.0", ] diff --git a/src/semantic_release/cli/changelog_writer.py b/src/semantic_release/cli/changelog_writer.py index 65e387896..b61f70367 100644 --- a/src/semantic_release/cli/changelog_writer.py +++ b/src/semantic_release/cli/changelog_writer.py @@ -5,8 +5,11 @@ from pathlib import Path from typing import TYPE_CHECKING -# NOTE: use backport with newer API than stdlib -from importlib_resources import files +try: + from importlib.resources import files # type: ignore[attr-defined] +except ImportError: + # NOTE: for 3.8, use backport with newer API than stdlib + from importlib_resources import files import semantic_release from semantic_release.changelog.context import ( diff --git a/tests/fixtures/example_project.py b/tests/fixtures/example_project.py index bf1bf6307..50a717429 100644 --- a/tests/fixtures/example_project.py +++ b/tests/fixtures/example_project.py @@ -9,8 +9,11 @@ import pytest import tomlkit -# NOTE: use backport with newer API -from importlib_resources import files +try: + from importlib.resources import files # type: ignore[attr-defined] +except ImportError: + # NOTE: for 3.8, use backport with newer API than stdlib + from importlib_resources import files import semantic_release from semantic_release.cli.config import ( diff --git a/tests/unit/semantic_release/changelog/test_default_changelog.py b/tests/unit/semantic_release/changelog/test_default_changelog.py index 6e42f7fad..1eefe69db 100644 --- a/tests/unit/semantic_release/changelog/test_default_changelog.py +++ b/tests/unit/semantic_release/changelog/test_default_changelog.py @@ -5,8 +5,11 @@ import pytest -# NOTE: use backport with newer API -from importlib_resources import files +try: + from importlib.resources import files # type: ignore[attr-defined] +except ImportError: + # NOTE: for 3.8, use backport with newer API than stdlib + from importlib_resources import files import semantic_release from semantic_release.changelog.context import ChangelogMode, make_changelog_context diff --git a/tests/unit/semantic_release/changelog/test_release_notes.py b/tests/unit/semantic_release/changelog/test_release_notes.py index 02f217bf1..600d8199e 100644 --- a/tests/unit/semantic_release/changelog/test_release_notes.py +++ b/tests/unit/semantic_release/changelog/test_release_notes.py @@ -8,8 +8,11 @@ import pytest -# NOTE: use backport with newer API to support 3.7 -from importlib_resources import files +try: + from importlib.resources import files # type: ignore[attr-defined] +except ImportError: + # NOTE: for 3.8, use backport with newer API than stdlib + from importlib_resources import files import semantic_release from semantic_release.cli.changelog_writer import generate_release_notes