Skip to content

Require new HA version for device class sync script#810

Merged
TheJulianJES merged 5 commits into
zigpy:devfrom
TheJulianJES:tjj/latest-homeassistant-test-dep
Jul 2, 2026
Merged

Require new HA version for device class sync script#810
TheJulianJES merged 5 commits into
zigpy:devfrom
TheJulianJES:tjj/latest-homeassistant-test-dep

Conversation

@TheJulianJES

@TheJulianJES TheJulianJES commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Note: This is only used in the testing group. ZHA doesn't require homeassistant, of course.
This is only used for one sync-script. We'll have a better way to sync device classes, similar to ESPHome, in the future.

Problem

Dependabot fails to build dependencies with:

× Failed to build `homeassistant==0.7.0`
  ╰─▶ ... FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
  help: `homeassistant` (v0.7.0) was included because `zha[testing]` (v2.0.0)
        depends on `homeassistant`

This surfaced only after #807 unblocked the earlier resolution cycle. The homeassistant test dependency was unbounded, so a from-scratch resolve (e.g. Dependabot backtracking) could descend all the way to homeassistant==0.7.0, whose sdist reads a requirements.txt that isn't shipped and therefore fails to build.

Why we can't just raise the floor a little

Newer Home Assistant simply can't be installed on Python 3.12/3.13:

  • HA 2025.1.0 – 2026.2.x each pin an exact, older uv (uv==0.9.6, 0.9.17, 0.9.26, …), which conflicts with our uv>=0.11.16.
  • HA >=2026.3.0 requires Python >=3.14.2.

So on Python 3.12/3.13 the newest installable HA is 2024.9.3. You can reproduce the conflict yourself:

uv lock --upgrade-package 'homeassistant>=2025.1.0'

Fix

Gate the dependency to Python 3.14.2+ and floor it at the current latest:

"homeassistant>=2026.7.0; python_full_version >= '3.14.2'",
  • The latest HA (2026.7.0) is used where it can be (Python 3.14.2+).
  • On Python 3.12/3.13, HA is simply absent — no unbuildable ancient versions in the candidate set, so the Dependabot build crash can't recur.

Verified: a tagless from-scratch uv lock resolves cleanly and homeassistant 0.7.0 never appears.

Does this affect CI?

No. homeassistant is not imported by the test suite — the only importer is tools/compare_constants.py (a maintenance script). So dropping it on the 3.12/3.13 CI jobs doesn't change pytest; it only means that script needs Python 3.14.2+.

Follow-up: we likely want to drop this dependency entirely

Since homeassistant is only used by tools/compare_constants.py, it probably shouldn't be a declared test dependency at all. The plan is to add an automatic workflow that syncs the HA device classes, and have that workflow install homeassistant manually rather than carrying it in pyproject.toml. This PR is the minimal fix to unblock Dependabot in the meantime.

Home Assistant is only pulled in for the device snapshot tests. It was
unpinned, so uv could resolve it as far back as 0.7.0 whose sdist fails
to build, breaking from-scratch resolves (e.g. Dependabot).

Newer HA can't be used on Python 3.12/3.13: 2025.1.0-2026.2.x pin an
exact, older uv that conflicts with our uv>=0.11.16, and HA >=2026.3.0
requires Python >=3.14.2. So gate the dependency to Python 3.14.2+ and
floor it at the current latest (2026.6.4). The snapshot tooling only
imports HA (tools/compare_constants.py), so this doesn't affect the CI
test run on older Python.
@TheJulianJES TheJulianJES changed the title Track the latest Home Assistant version in the device snapshot test dep Require new HA version for device class sync Jul 1, 2026
@TheJulianJES TheJulianJES changed the title Require new HA version for device class sync Require new HA version for device class sync script Jul 1, 2026
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.29%. Comparing base (8d3074a) to head (c22beff).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #810   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files          55       55           
  Lines       10933    10933           
=======================================
  Hits        10637    10637           
  Misses        296      296           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pyproject.toml Outdated
@TheJulianJES TheJulianJES marked this pull request as ready for review July 2, 2026 00:08
Copilot AI review requested due to automatic review settings July 2, 2026 00:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents dependency resolvers (notably Dependabot) from selecting extremely old, unbuildable homeassistant sdists by making the homeassistant test extra conditional on Python ≥ 3.14.2 and flooring it to a modern Home Assistant release. This keeps dependency resolution stable on Python 3.12/3.13 while still enabling the device-class/constant sync maintenance workflow on newer Python.

Changes:

  • Add a Python-version marker to the homeassistant entry in the testing extra so it is only considered on Python ≥ 3.14.2.
  • Floor homeassistant to >=2026.7.0 to avoid backtracking to ancient, broken sdists.
  • Add an inline comment explaining why homeassistant is gated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment thread pyproject.toml

@puddly puddly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TheJulianJES TheJulianJES merged commit 93d3e50 into zigpy:dev Jul 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants