Skip to content

Backport #32378 to 2.0: cap pygtrie below 2.6 so import airflow works on Python 3.10 - #32432

Merged
Khairajani merged 3 commits into
2.0from
backport/pygtrie-2.6-py310-import-2.0
Sep 2, 2026
Merged

Khairajani merged 3 commits into
2.0from
backport/pygtrie-2.6-py310-import-2.0

Conversation

@Khairajani

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #32378 to 2.0. Original issue: #32377.

pygtrie 2.6.0 (published 2026-09-01T11:06Z) annotates with typing.Self (PEP 673, Python 3.11+) but declares no requires-python floor, so pip and uv install it on 3.10, where it is unimportable:

$ python3.10 -c "import pygtrie"
AttributeError: module 'typing' has no attribute 'Self'   # pygtrie.py:83, `def __copy__(self) -> _t.Self`

apache-airflow-core and apache-airflow-task-sdk both require pygtrie>=2.5.0 with no ceiling, and airflow._shared.logging.structlog imports it at module level — reached from airflow/__init__.py via configuration.initialize_secrets_backends(). The AttributeError therefore surfaces as:

ImportError: cannot import name 'Connection' from 'airflow.models'

which on main took out python / Unit Tests & Static Checks (3.10) and python / Integration Tests (shard-3, 3.10), turning py-tests-status red and evicting every PR touching ingestion/ from the merge queue.

Why 2.0 needs it. This branch pins apache-airflow==3.3.1 (so it pulls apache-airflow-core/task-sdk and their uncapped pygtrie>=2.5.0), runs MAIN_PYTHON_VERSION: "3.10" with a ["3.10","3.11","3.12"] matrix, and does not carry the cap. pygtrie 2.6.0 is now PyPI's latest, so any fresh resolution here selects it. The breakage is currently latent only because recent runs on this base have had their Python jobs path-filtered to skipped; the first PR that touches ingestion/ and actually runs the suite will be blocked.

Cherry-picked clean, no conflicts — identical three-line change (cap in VERSIONS, applied to the airflow plugin extra and to the test extra, which is where CI actually pulls Airflow in).

Type of change:

  • Bug fix

High-level design:

N/A — dependency cap backport.

Tests:

Use cases covered

  • ingestion[test] resolves on Python 3.10 with an importable pygtrie
  • import airflow works, so the Airflow connector unit tests and integration shard-3 collect

Unit tests

  • Not applicable — dependency constraint; verification is the resolver and CI itself.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion code changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Full resolver dry-run of the affected extra against this branch on Python 3.10 — no conflict:

$ python3.10 -m pip install --dry-run --ignore-installed "./ingestion[test]"
  pygtrie: 2.5.0
  apache-airflow: 3.3.1
  apache-airflow-core: 3.3.1

ruff check and ruff format --check clean. This PR's own py-tests run on 3.10 is the real regression test.

UI screen recording / screenshots:

Not applicable.

Checklist:

…thon 3.10 (#32378)

pygtrie 2.6.0 (released 2026-09-01T11:06Z) annotates with typing.Self, which
only exists on 3.11+, yet publishes no requires-python floor -- so pip and uv
happily install it on 3.10, where `import pygtrie` raises

    AttributeError: module 'typing' has no attribute 'Self'

apache-airflow-core and apache-airflow-task-sdk both require pygtrie>=2.5.0
with no ceiling, and airflow._shared.logging.structlog imports it at module
level. That module is reached from airflow/__init__.py through
configuration.initialize_secrets_backends(), so the AttributeError surfaces as

    ImportError: cannot import name 'Connection' from 'airflow.models'

which took out every py-tests run that resolved dependencies after 11:06Z on
the 3.10 lane -- unit tests and integration shard-3 alike. 3.11 and 3.12 were
unaffected because they have typing.Self.

Cap it in VERSIONS and apply it both to the airflow plugin extra and to the
test extra, which is where CI actually pulls Airflow in. Drop the cap once
pygtrie declares its floor or 3.10 support is dropped.

(cherry picked from commit 0fab248)
@Khairajani
Khairajani requested a review from a team as a code owner September 2, 2026 06:17
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 583b87673334fd48364f84438c869088d334d33d in Playwright run 33609381412, attempt 1.

✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 54m 53s

⏱️ Max setup 3m 49s · max shard execution 12m 7s · max shard-job elapsed before upload 18m 16s · reporting 3s

🌐 209.15 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 209.15 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.79 per UI scenario (216 boots / 121 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 34 0 0 0 0 0
✅ Shard ingestion-02 30 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@Khairajani Khairajani added skip-pr-checks Bypass PR metadata validation check safe to test Add this label to run secure Github workflows on PRs labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

…sses on 2.0

The file was backported from main, where PLC0415 (import-outside-top-level) sits
in the global ruff ignore list, so its three function-local imports carry no
suppression. On this branch the rule is only waived through per-file-ignores that
do not cover openmetadata-airflow-apis/, so `make py_format_check` fails on every
PR against 2.0, unrelated to the change under review.

The imports are deliberate -- each test patches utils.settings before importing
the module under test -- so suppress rather than hoist, matching how the sibling
airflow-apis tests already do it (see test_deploy.py:60) and how pyproject.toml
documents grandfathering existing violations. Added with `ruff check --add-noqa`;
`make py_format` cannot fix PLC0415 on its own since the rule has no autofix.
@gitar-bot

gitar-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Caps pygtrie below 2.6 to restore import airflow on Python 3.10, fixing a latent breakage where pygtrie 2.6.0 uses typing.Self (Python 3.11+) without declaring a requires-python floor. Clean backport with no issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@yan-3005 yan-3005 mentioned this pull request Sep 3, 2026
9 tasks done

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant