Skip to content

Commit f89d8e8

Browse files
ritwik-gclaude
andcommitted
Drop Python 3.8 support and modernize type annotations
- Updated minimum Python version to 3.9 in pyproject.toml - Removed Python 3.8 from CI matrix and tox environments - Modernized type annotations to use built-in types (list, dict, set) instead of typing.List, Dict, Set - Updated tool configurations (ruff, black, mypy) to target Python 3.9 - This eliminates compatibility issues and simplifies our CI pipeline 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 471c966 commit f89d8e8

File tree

10 files changed

+87
-666
lines changed

10 files changed

+87
-666
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1717
exclude:
1818
# Skip some combinations to reduce CI time
19-
- os: macos-latest
20-
python-version: "3.8"
2119
- os: macos-latest
2220
python-version: "3.9"
23-
- os: windows-latest
24-
python-version: "3.8"
2521
- os: windows-latest
2622
python-version: "3.9"
2723

coverage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" ?>
2-
<coverage version="7.9.1" timestamp="1749999842814" lines-valid="910" lines-covered="735" line-rate="0.8077" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
2+
<coverage version="7.9.1" timestamp="1750000013912" lines-valid="910" lines-covered="735" line-rate="0.8077" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
33
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.9.1 -->
44
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
55
<sources>

helm_values_manager/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Centralized error handling utilities for consistent error formatting."""
22

3-
from typing import List, Optional
3+
from typing import Optional
44

55
import typer
66
from rich.console import Console
@@ -31,7 +31,7 @@ def print_warning(message: str) -> None:
3131
error_console.print(f"[yellow]Warning:[/yellow] {message}")
3232

3333
@staticmethod
34-
def print_errors(errors: List[str], context: Optional[str] = None) -> None:
34+
def print_errors(errors: list[str], context: Optional[str] = None) -> None:
3535
"""Print multiple errors at once."""
3636
if not errors:
3737
return

helm_values_manager/generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Generator module for creating values.yaml from schema and values."""
22

33
import os
4-
from typing import Any, Dict
4+
from typing import Any
55

66
import yaml
77

@@ -10,7 +10,7 @@
1010
from helm_values_manager.utils import is_secret_reference
1111

1212

13-
def resolve_secret(secret: Dict[str, Any], key: str) -> str:
13+
def resolve_secret(secret: dict[str, Any], key: str) -> str:
1414
"""Resolve a secret reference to its actual value.
1515
1616
Args:
@@ -37,7 +37,7 @@ def resolve_secret(secret: Dict[str, Any], key: str) -> str:
3737
return value
3838

3939

40-
def build_nested_dict(flat_values: Dict[str, Any], schema: Schema) -> Dict[str, Any]:
40+
def build_nested_dict(flat_values: dict[str, Any], schema: Schema) -> dict[str, Any]:
4141
"""Build a nested dictionary from flat values using schema paths.
4242
4343
Args:
@@ -80,7 +80,7 @@ def build_nested_dict(flat_values: Dict[str, Any], schema: Schema) -> Dict[str,
8080
return result
8181

8282

83-
def generate_values(schema: Schema, values: Dict[str, Any], env: str) -> str:
83+
def generate_values(schema: Schema, values: dict[str, Any], env: str) -> str:
8484
"""Generate values.yaml content from schema and environment values.
8585
8686
Args:

helm_values_manager/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Literal, Optional, Union
1+
from typing import Any, Literal, Optional, Union
22

33
from pydantic import BaseModel, Field, RootModel
44

@@ -18,7 +18,7 @@ class SchemaValue(BaseModel):
1818

1919
class Schema(BaseModel):
2020
version: str = Field(default="1.0", description="Schema version")
21-
values: List[SchemaValue] = Field(default_factory=list, description="List of value definitions")
21+
values: list[SchemaValue] = Field(default_factory=list, description="List of value definitions")
2222

2323

2424
class SecretReference(BaseModel):
@@ -27,10 +27,10 @@ class SecretReference(BaseModel):
2727

2828

2929
# Type for a value in the values file - can be a regular value or a secret reference
30-
ValueEntry = Union[str, int, float, bool, List, Dict, SecretReference]
30+
ValueEntry = Union[str, int, float, bool, list, dict, SecretReference]
3131

3232

33-
class ValuesFile(RootModel[Dict[str, Any]]):
33+
class ValuesFile(RootModel[dict[str, Any]]):
3434
"""Represents a values file for an environment."""
3535

36-
root: Dict[str, Any] = Field(default_factory=dict)
36+
root: dict[str, Any] = Field(default_factory=dict)

helm_values_manager/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
from pathlib import Path
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Optional
44

55
from helm_values_manager.models import Schema
66

@@ -51,7 +51,7 @@ def get_values_file_path(env: str, values_path: Optional[str] = None) -> str:
5151
return f"values-{env}.json"
5252

5353

54-
def load_values(env: str, values_path: Optional[str] = None) -> Dict[str, Any]:
54+
def load_values(env: str, values_path: Optional[str] = None) -> dict[str, Any]:
5555
"""Load values for an environment."""
5656
path = Path(get_values_file_path(env, values_path))
5757
if not path.exists():
@@ -63,7 +63,7 @@ def load_values(env: str, values_path: Optional[str] = None) -> Dict[str, Any]:
6363
return data
6464

6565

66-
def save_values(values: Dict[str, Any], env: str, values_path: Optional[str] = None) -> None:
66+
def save_values(values: dict[str, Any], env: str, values_path: Optional[str] = None) -> None:
6767
"""Save values for an environment."""
6868
path = get_values_file_path(env, values_path)
6969
with open(path, "w") as f:

helm_values_manager/validator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import os
55
from pathlib import Path
6-
from typing import Dict, List, Any, Optional, Set
6+
from typing import Any, Optional
77

88
from rich.console import Console
99
from rich.text import Text
@@ -47,7 +47,7 @@ class Validator:
4747
def __init__(self, schema_path: Path, values_base_path: Optional[Path] = None):
4848
self.schema_path = schema_path
4949
self.values_base_path = values_base_path or Path(".")
50-
self.errors: List[ValidationError] = []
50+
self.errors: list[ValidationError] = []
5151

5252
def validate_all(self, env: Optional[str] = None) -> bool:
5353
"""Validate schema and optionally values for specific environment."""
@@ -88,8 +88,8 @@ def _validate_schema(self):
8888
self.errors.append(ValidationError("Schema", f"Unsupported version: {schema.version}"))
8989

9090
# Validate each entry
91-
seen_keys: Set[str] = set()
92-
seen_paths: Set[str] = set()
91+
seen_keys: set[str] = set()
92+
seen_paths: set[str] = set()
9393

9494
for entry in schema.values:
9595
# Check for duplicate keys
@@ -248,7 +248,7 @@ def print_errors(self):
248248
console.print(f" - {str(error)}")
249249

250250

251-
def validate_single_environment(schema: Schema, values: Dict[str, Any], env: str) -> List[str]:
251+
def validate_single_environment(schema: Schema, values: dict[str, Any], env: str) -> list[str]:
252252
"""Validate schema and values for a single environment and return list of errors.
253253
254254
Args:
@@ -303,7 +303,7 @@ def validate_single_environment(schema: Schema, values: Dict[str, Any], env: str
303303
return errors
304304

305305

306-
def _validate_schema_integrity(schema: Schema) -> List[str]:
306+
def _validate_schema_integrity(schema: Schema) -> list[str]:
307307
"""Validate schema for duplicate keys and paths."""
308308
errors = []
309309

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "helm-values-manager"
33
version = "1.0.0"
44
description = "A schema-driven tool for managing Helm values with environment-specific configurations and secret management"
55
readme = "README.md"
6-
requires-python = ">=3.8"
6+
requires-python = ">=3.9"
77
dependencies = [
88
"typer>=0.16.0",
99
"rich>=14.0.0",
@@ -31,14 +31,14 @@ dev-dependencies = [
3131

3232
[tool.ruff]
3333
line-length = 100
34-
target-version = "py38"
34+
target-version = "py39"
3535

3636
[tool.black]
3737
line-length = 100
38-
target-version = ["py38"]
38+
target-version = ["py39"]
3939

4040
[tool.mypy]
41-
python_version = "3.8"
41+
python_version = "3.9"
4242
strict = true
4343

4444
[tool.pytest.ini_options]

tox.ini

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py38,py39,py310,py311,py312,lint,type-check
2+
envlist = py39,py310,py311,py312,lint,type-check
33
isolated_build = true
44

55
[testenv]
@@ -20,9 +20,6 @@ setenv =
2020
TERM = dumb
2121

2222
# Python version specific environments
23-
[testenv:py3.8]
24-
basepython = python3.8
25-
2623
[testenv:py3.9]
2724
basepython = python3.9
2825

0 commit comments

Comments
 (0)