diff --git a/ci_cd/tasks/update_deps.py b/ci_cd/tasks/update_deps.py index 1a552336..8529b93f 100644 --- a/ci_cd/tasks/update_deps.py +++ b/ci_cd/tasks/update_deps.py @@ -119,7 +119,10 @@ def update_deps( ) py_version = match.group("version") - already_handled_packages = set() + # Skip package if it is this project (this can happen for inter-relative extra + # dependencies) + already_handled_packages = {pyproject["project"]["name"]} + updated_packages = {} dependencies = pyproject.get("project", {}).get("dependencies", []) for optional_deps in ( diff --git a/pyproject.toml b/pyproject.toml index 9172784e..e4f35850 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,8 +46,8 @@ testing = [ "pytest-cov ~=4.1", ] dev = [ - "ci-cd[docs,testing]", "pre-commit ~=2.21", + "ci-cd[docs,testing]", ] [project.urls] diff --git a/tests/tasks/test_update_deps.py b/tests/tasks/test_update_deps.py index 380a3cbd..7e9ca18d 100644 --- a/tests/tasks/test_update_deps.py +++ b/tests/tasks/test_update_deps.py @@ -33,6 +33,7 @@ def test_update_deps(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None: pyproject_file.write_text( data=f""" [project] +name = "test" requires-python = "~=3.7" dependencies = [ @@ -50,10 +51,9 @@ def test_update_deps(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None: ] dev = [ "mike >={original_dependencies['mike']},<3", - "pytest ~={original_dependencies['pytest']}", - "pytest-cov ~={original_dependencies['pytest-cov']}", "pre-commit ~={original_dependencies['pre-commit']}", "pylint ~={original_dependencies['pylint']}", + "test[testing]", ] # List from https://peps.python.org/pep-0508/#complete-grammar @@ -160,6 +160,12 @@ def test_update_deps(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None: "'name5 [fred,bar]' is pinned to a URL and will be skipped" in caplog.text ) + elif "test[testing]" in line: + assert line == "test[testing]" + assert ( + "'test[testing]' is not version restricted and will be skipped." + not in caplog.text + ) else: pytest.fail(f"Unknown package in line: {line}") @@ -1130,6 +1136,7 @@ def test_ignore_rules_logic( pyproject_file.write_text( data=f""" [project] +name = "test" requires-python = "~=3.7" dependencies = [