Skip to content

Commit f6cae90

Browse files
authored
CherryPicked: [v4.19]ci(deps): lock file maintenance (v4.20) (#2720)
* CherryPicked: [v4.20] ci(deps): lock file maintenance (main) (#2715) * ci(deps): lock file maintenance (main) (#2702) * ci(deps): lock file maintenance * Update Python compatibility markers and modernize code Update resolution markers to support Python 3.12 as primary version with 3.11 as fallback. Modernize Python 3.10+ syntax by replacing typing constructs with built-in generics (Optional → None union, List → list, Tuple → tuple). Update imports to use traceback at module level and refactor error handling from assert to raise AssertionError. Simplify failure summary output by removing truncation logic. Replace uv.lock with updated dependencies reflecting Python version changes. * chore: update pre-commit dependencies Update ruff to v0.15.12, gitleaks to v8.30.1, and mypy to v1.20.2. Also remove unnecessary space in string join operation in test fixture. * Fix CLI tool invocations with missing configuration flags Update pytest, prek, and ruff commands to include their required configuration flags. Add `--group tests` to pytest invocation, add `-c .pre-commit-config.yaml` to prek invocation, and add `--config pyproject.toml` to ruff invocation. Also remove extra space in string join operation for consistency. * test: Update pytest invocation with test dependency group The pytest command in the CLI test now includes the `--group tests` flag to ensure the test dependencies are available when running pytest through the uv package manager. * Refactor imports in class_generator_template.j2 Reorganize imports to improve readability and add conditional import for MissingRequiredArgumentError. The exception import is now only included when there are required arguments that will actually use it, reducing unnecessary dependencies in generated classes with no required arguments. * Remove extra blank line in class_generator_template.j2 * Improve file formatting with prek and ruff fallback Add ruff as a fallback formatter when prek fails. Extract project root path calculation to module level and pass configuration paths explicitly to prek. Introduce _run_ruff_fallback() helper that runs ruff check and ruff format sequentially. Update logging to clarify fallback behavior and fix typo in prek stdout log message. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <myakove@gmail.com> * fix: revert ruff to v0.14.2, fix mock tests, regenerate manifests - Revert ruff from v0.15.12 to v0.14.2 in pre-commit config to avoid 90+ new lint errors from stricter rules on maintenance branch - Fix TestCheckAndUpdateClusterVersion mock tests by adding _get_open_mode() helper to handle missing positional mode argument - Regenerate 18 test manifest files to match current generator output Assisted-by: Claude <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <myakove@gmail.com> Co-authored-by: rnetser <rnetser@redhat.com> Signed-off-by: manage-repositories-app[bot] <rnetser@redhat.com> * fix: restore OAuth/Pipeline tests and regenerate manifests - Re-add OAuth and Pipeline to test_parse_explain test list — they were accidentally dropped during cherry-pick conflict resolution - Regenerate Image, OAuth, and Pipeline manifest files to match current generator output Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: rnetser <rnetser@redhat.com> --------- Signed-off-by: manage-repositories-app[bot] <rnetser@redhat.com> Signed-off-by: rnetser <rnetser@redhat.com>
1 parent 26ce62d commit f6cae90

20 files changed

Lines changed: 33 additions & 8 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ repos:
5252
- id: ruff-format
5353

5454
- repo: https://github.com/gitleaks/gitleaks
55-
rev: v8.27.2
55+
rev: v8.30.1
5656
hooks:
5757
- id: gitleaks
5858

5959
- repo: https://github.com/pre-commit/mirrors-mypy
60-
rev: v1.16.1
60+
rev: v1.20.2
6161
hooks:
6262
- id: mypy
6363
exclude: ^(tests/|examples/|docs/)

class_generator/manifests/class_generator_template.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
{% endfor %}
99

1010
from typing import Any
11-
from ocp_resources.resource import {{ base_class }}, MissingRequiredArgumentError
11+
12+
{% if all_required_args %}
13+
from ocp_resources.exceptions import MissingRequiredArgumentError
14+
{% endif %}
15+
from ocp_resources.resource import {{ base_class }}
1216

1317

1418
class {{ kind }}({{ base_class }}):

class_generator/tests/manifests/APIServer/api_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

class_generator/tests/manifests/ClusterOperator/cluster_operator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

class_generator/tests/manifests/ConfigMap/config_map.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import NamespacedResource
78

89

class_generator/tests/manifests/DNS/dns_config_openshift_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

class_generator/tests/manifests/DNS/dns_operator_openshift_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

class_generator/tests/manifests/Deployment/deployment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from __future__ import annotations
44

55
from typing import Any
6-
from ocp_resources.resource import NamespacedResource, MissingRequiredArgumentError
6+
7+
from ocp_resources.exceptions import MissingRequiredArgumentError
8+
from ocp_resources.resource import NamespacedResource
79

810

911
class Deployment(NamespacedResource):

class_generator/tests/manifests/Image/image_config_openshift_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

class_generator/tests/manifests/Image/image_image_openshift_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Any
6+
67
from ocp_resources.resource import Resource
78

89

0 commit comments

Comments
 (0)