From 3cfd89c93e855052bd4ef901f549caf88df60d11 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Mon, 27 Apr 2026 10:36:11 +0200 Subject: [PATCH] WIP Add sync as a capability This adds a deprecation warning when used without the declared capability. --- CHANGES/pulp-glue/+sync_capability.removal | 1 + .../pyproject.toml.update | 6 +++++- .../{{ cookiecutter.__project_name }}/pyproject.toml.update | 6 +++++- pulp-glue/pyproject.toml | 6 +++++- pulp-glue/src/pulp_glue/common/context.py | 2 ++ pyproject.toml | 6 +++++- 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 CHANGES/pulp-glue/+sync_capability.removal diff --git a/CHANGES/pulp-glue/+sync_capability.removal b/CHANGES/pulp-glue/+sync_capability.removal new file mode 100644 index 000000000..733952dec --- /dev/null +++ b/CHANGES/pulp-glue/+sync_capability.removal @@ -0,0 +1 @@ +Added a precheck for the `sync` capability to repositories. All repository types should adequately announce it. diff --git a/cookiecutter/ci/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml.update b/cookiecutter/ci/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml.update index 137b11066..07615bdb5 100644 --- a/cookiecutter/ci/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml.update +++ b/cookiecutter/ci/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml.update @@ -18,7 +18,11 @@ line-length = 100 [tool.ruff.lint] # This section is managed by the cookiecutter templates. -extend-select = ["I", "INT"] +extend-select = ["I", "ICN", "INT", "T10"] + +[tool.ruff.lint.flake8-import-conventions.aliases] +# This section is managed by the cookiecutter templates. +typing = "t" [tool.mypy] # This section is managed by the cookiecutter templates. diff --git a/cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update b/cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update index 13a26746b..31f57c48e 100644 --- a/cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update +++ b/cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update @@ -208,13 +208,17 @@ extend-exclude = ["cookiecutter/bootstrap", "cookiecutter/ci", "cookiecutter/doc [tool.ruff.lint] # This section is managed by the cookiecutter templates. -extend-select = ["I", "INT"] +extend-select = ["I", "ICN", "INT", "T10"] [tool.ruff.lint.isort] # This section is managed by the cookiecutter templates. sections = { second-party = ["pulp_glue"] } section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"] +[tool.ruff.lint.flake8-import-conventions.aliases] +# This section is managed by the cookiecutter templates. +typing = "t" + [tool.mypy] # This section is managed by the cookiecutter templates. strict = true diff --git a/pulp-glue/pyproject.toml b/pulp-glue/pyproject.toml index a73d375f4..66161aee5 100644 --- a/pulp-glue/pyproject.toml +++ b/pulp-glue/pyproject.toml @@ -75,5 +75,9 @@ line-length = 100 [tool.ruff.lint] # This section is managed by the cookiecutter templates. -extend-select = ["I", "INT"] +extend-select = ["I", "ICN", "INT", "T10"] + +[tool.ruff.lint.flake8-import-conventions.aliases] +# This section is managed by the cookiecutter templates. +typing = "t" diff --git a/pulp-glue/src/pulp_glue/common/context.py b/pulp-glue/src/pulp_glue/common/context.py index be6f74e9c..c0d7f801c 100644 --- a/pulp-glue/src/pulp_glue/common/context.py +++ b/pulp-glue/src/pulp_glue/common/context.py @@ -1643,6 +1643,8 @@ def sync(self, body: EntityDefinition | None = None) -> t.Any: Returns: Record of the sync task. """ + if not self.capable("sync"): + warnings.warn(DeprecationWarning("Repository has not declared 'sync' capability.")) return self.call("sync", parameters={self.HREF: self.pulp_href}, body=body or {}) def modify( diff --git a/pyproject.toml b/pyproject.toml index 0491dd4bc..5dd22f499 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -245,13 +245,17 @@ extend-exclude = ["cookiecutter/bootstrap", "cookiecutter/ci", "cookiecutter/doc [tool.ruff.lint] # This section is managed by the cookiecutter templates. -extend-select = ["I", "INT"] +extend-select = ["I", "ICN", "INT", "T10"] [tool.ruff.lint.isort] # This section is managed by the cookiecutter templates. sections = { second-party = ["pulp_glue"] } section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"] +[tool.ruff.lint.flake8-import-conventions.aliases] +# This section is managed by the cookiecutter templates. +typing = "t" + [tool.pytest] testpaths = ["tests", "pulp_glue/tests"]