This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-2-test by this push:
new e6927bd8222 [v3-2-test] Fix dev/registry tomllib import on Python 3.10
(#65987) (#65988)
e6927bd8222 is described below
commit e6927bd82224bb4c61b5a5124b5ee844ded507ab
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri May 1 17:22:21 2026 +0200
[v3-2-test] Fix dev/registry tomllib import on Python 3.10 (#65987) (#65988)
`dev/registry/extract_versions.py` and `extract_metadata.py` both
`import tomllib` directly. `tomllib` is Python 3.11+ stdlib. uv on
bare CI runners may pick Python 3.10 and the scripts crash on import:
File "dev/registry/extract_versions.py", line 49, in <module>
import tomllib
ModuleNotFoundError: No module named 'tomllib'
Failure observed in `Registry Backfill` workflow run 25028614525 -- every
backfill job fails before extracting any data.
The bug was latent: previously `breeze registry backfill` invoked
`uv run python ...` from the airflow workspace root (without
`--project dev/registry`), so uv used the airflow workspace's pyproject
to resolve Python. After #65972 landed `--project dev/registry`, uv
started honouring this pyproject's constraint specifically, and CI
runners with Python 3.10 as default started picking it.
This adds the standard `tomli` fallback to both scripts and declares
`tomli` as a runtime dep on Python <3.11. The `[build-system].requires`
already conditionally pulled `tomli`, but it wasn't a runtime dep so
the scripts couldn't actually use it -- this PR adds it where it
belongs (under `[project].dependencies`).
The alternative -- bumping `requires-python` to `>=3.11` -- breaks the
airflow workspace sync on the 3.10 CI image build, since uv refuses
to mix Python versions across workspace members.
(cherry picked from commit 0c1326535d16b824748b9c9c01a1b05e8538967f)
Co-authored-by: Kaxil Naik <[email protected]>
---
dev/registry/extract_metadata.py | 6 +++++-
dev/registry/extract_versions.py | 5 ++++-
dev/registry/pyproject.toml | 3 +++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dev/registry/extract_metadata.py b/dev/registry/extract_metadata.py
index 2f7ba8afeb0..b05ea0b8587 100644
--- a/dev/registry/extract_metadata.py
+++ b/dev/registry/extract_metadata.py
@@ -41,7 +41,11 @@ from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import Any
-import tomllib
+try:
+ import tomllib # Python 3.11+ stdlib
+except ModuleNotFoundError: # pragma: no cover -- Python 3.10 fallback
+ import tomli as tomllib
+
import yaml
from registry_contract_models import validate_providers_catalog
diff --git a/dev/registry/extract_versions.py b/dev/registry/extract_versions.py
index 216a6a9575e..d9dc4e166dc 100644
--- a/dev/registry/extract_versions.py
+++ b/dev/registry/extract_versions.py
@@ -46,7 +46,10 @@ from datetime import datetime, timezone
from pathlib import Path
from typing import Any
-import tomllib
+try:
+ import tomllib # Python 3.11+ stdlib
+except ModuleNotFoundError: # pragma: no cover -- Python 3.10 fallback
+ import tomli as tomllib
from registry_contract_models import validate_provider_version_metadata
try:
diff --git a/dev/registry/pyproject.toml b/dev/registry/pyproject.toml
index 1b53cb882f0..50cc50db15d 100644
--- a/dev/registry/pyproject.toml
+++ b/dev/registry/pyproject.toml
@@ -35,6 +35,9 @@ classifiers = ["Private :: Do Not Upload"]
dependencies = [
"pydantic>=2.12.0",
"pyyaml>=6.0.3",
+ # extract_versions.py and extract_metadata.py read pyproject.toml via
+ # tomllib (3.11+ stdlib). Fall back to the `tomli` backport on 3.10.
+ "tomli>=2.0.0; python_version < '3.11'",
]
[dependency-groups]