fix: Update minimum Python version in pyproject.toml and CI workflow to ensure compatibility and streamline version management

This commit is contained in:
Golam Rashed
2025-10-01 02:42:03 +10:00
parent 45e9e605b8
commit ea806ae793
2 changed files with 16 additions and 3 deletions
+15 -2
View File
@@ -382,7 +382,7 @@ jobs:
# - Programming Language :: Python :: {{LATEST-2}} → 3.11
# - Programming Language :: Python :: {{LATEST-1}} → 3.12
# - Programming Language :: Python :: {{LATEST}} → 3.13
# - requires-python = ">=3.{{LATEST-4}}" → ">=3.9"
# - requires-python: Updates minimum version if it changes (currently >=3.9)
# Preserves all other classifiers including Development Status :: 5 - Production/Stable
run: |
python << 'EOF'
@@ -395,6 +395,7 @@ jobs:
python_versions = json.loads(python_versions_str)
print(f"Updating pyproject.toml with Python versions: {python_versions}")
print(f"Minimum Python version: {python_versions[0]}")
# Read pyproject.toml
with open('pyproject.toml', 'r') as f:
@@ -410,15 +411,27 @@ jobs:
print(f"Placeholder mappings: {replacements}")
# Get minimum version for requires-python
min_version = python_versions[0]
# Process each line and replace placeholders
updated_lines = []
for line in lines:
updated_line = line
# Replace Python version placeholders
# Replace Python version placeholders in classifiers
for placeholder, version in replacements.items():
if placeholder in line:
updated_line = updated_line.replace(placeholder, version)
print(f" Replaced: {placeholder} → {version}")
# Update requires-python to use minimum version (if it's still at default)
if 'requires-python' in line and '>=3.9' in line:
# Only update if we're changing to a different minimum version
if min_version != '3.9':
updated_line = line.replace('>=3.9', f'>={min_version}')
print(f" Updated requires-python: >=3.9 → >={min_version}")
updated_lines.append(updated_line)
# Write back to pyproject.toml