Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ repos:
stages: ['manual']
name: Run mypy for dev (manual)
language: python
entry: ./scripts/ci/prek/mypy_folder.py dev
entry: ./scripts/ci/prek/mypy_folder.py dev scripts
pass_filenames: false
files: ^.*\.py$
require_serial: true
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/prek/mypy_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"airflow-core",
*[f"providers/{provider_id.replace('.', '/')}" for provider_id in get_all_provider_ids()],
"dev",
"scripts",
"devel-common",
"task-sdk",
"airflow-ctl",
Expand Down
9 changes: 6 additions & 3 deletions scripts/ci/prek/upgrade_important_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_latest_image_version(image: str) -> str:

# DockerHub API endpoint for tags
url = f"https://registry.hub.docker.com/v2/repositories/{namespace}/{repository}/tags"
params = {"page_size": 100, "ordering": "last_updated"}
params: dict[str, int | str] = {"page_size": 100, "ordering": "last_updated"}

headers = {"User-Agent": "Python requests"}
response = requests.get(url, headers=headers, params=params)
Expand Down Expand Up @@ -463,7 +463,7 @@ def apply_pattern_replacements(


# Configuration for packages that follow simple version constant patterns
SIMPLE_VERSION_PATTERNS = {
SIMPLE_VERSION_PATTERNS: dict[str, list[tuple[str, str]]] = {
"hatch": [
(r"(HATCH_VERSION = )(\"[0-9.abrc]+\")", 'HATCH_VERSION = "{version}"'),
(r"(HATCH_VERSION=)(\"[0-9.abrc]+\")", 'HATCH_VERSION="{version}"'),
Expand Down Expand Up @@ -590,13 +590,16 @@ def update_file_with_versions(
new_content, latest_python_version, AIRFLOW_IMAGE_PYTHON_PATTERNS, keep_length
)

return _apply_simple_regexp_replacements(new_content, versions)


def _apply_simple_regexp_replacements(new_content: str, versions: dict[str, str]) -> str:
# Apply simple regex replacements
for package_name, patterns in SIMPLE_VERSION_PATTERNS.items():
should_upgrade = globals().get(f"UPGRADE_{package_name.upper()}", False)
version = versions.get(package_name, "")
if should_upgrade and version:
new_content = apply_simple_regex_replacements(new_content, version, patterns)

return new_content


Expand Down