Skip to content

Split requirements into dev and lint dependencies - #379

Merged
ludeeus merged 6 commits into
mainfrom
claude/lint-requirements-separation-i67en1
Jul 19, 2026
Merged

Split requirements into dev and lint dependencies#379
ludeeus merged 6 commits into
mainfrom
claude/lint-requirements-separation-i67en1

Conversation

@ludeeus

@ludeeus ludeeus commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Split the single requirements.txt into purpose-specific files so the lint CI job installs only what it needs (ruff), the pip pin lives in one shared place, and both CI and local dev upgrade pip before installing anything else.

Requirement files

  • requirements_common.txt (new)pip>=21.3.1. Shared by both the Lint CI job and local dev; installed first, on its own, so any pip self-upgrade completes before other packages.
  • requirements_lint.txt (new)ruff==0.15.21 only.
  • requirements_dev.txt (renamed from requirements.txt) — development/testing packages (colorlog, homeassistant), pulling in the lint tooling via -r requirements_lint.txt.

Key Changes

  • Renamed requirements.txtrequirements_dev.txt and extracted requirements_lint.txt (ruff) and requirements_common.txt (pip).
  • .github/workflows/lint.yml: installs requirements_common.txt and requirements_lint.txt as two separate pip install commands (pip upgrade first, then ruff), and pins cache-dependency-path to hash both files so the pip cache key reflects the actual installed dependencies.
  • scripts/setup: installs requirements_common.txt first, then requirements_dev.txt, applying the same pip-first ordering to local dev.
  • README.md: documents the three requirement files.

Benefits

  • Lint CI installs only ruff (+ pip) instead of the full homeassistant tree — faster, and decoupled from the runtime environment.
  • Single source of truth for the pip pin, named for its shared (CI + dev) role.
  • pip cache key correctly tracks the files actually installed by the lint job.
  • Installing pip separately, before other packages, avoids flakiness from pip upgrading itself mid-install — in both CI and local dev.

https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ

The Lint CI job only runs ruff but installed the full requirements file,
pulling in homeassistant just to lint. Extract a lint-only
requirements_lint.txt (pip + ruff) that the Lint workflow installs, and
rename the former requirements.txt to requirements_dev.txt to reflect its
dev/test purpose (a HA custom component declares runtime deps in
manifest.json). requirements_dev.txt includes requirements_lint.txt via
-r so the ruff pin lives in one place.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ
Copilot AI review requested due to automatic review settings July 19, 2026 12:05

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 reorganizes Python dependency management by splitting development/testing requirements from lint-only requirements, enabling the Lint CI workflow to install a smaller dependency set.

Changes:

  • Introduces requirements_lint.txt for lint tooling and updates the Lint workflow to install from it.
  • Updates requirements_dev.txt to include lint requirements via -r requirements_lint.txt and removes duplicated entries.
  • Updates local setup script and README documentation to reflect the new requirements file layout.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/setup Installs dev requirements from requirements_dev.txt for local development setup.
requirements_lint.txt New lint-only dependency list (pip + ruff).
requirements_dev.txt Dev/test dependencies now include lint deps via -r requirements_lint.txt.
README.md Documents the split requirements files and their purposes.
.github/workflows/lint.yml Lint job now installs from requirements_lint.txt.

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

Comment thread .github/workflows/lint.yml Outdated
setup-python's pip cache defaults to hashing **/requirements.txt, which no
longer exists after the rename to requirements_dev.txt. Set
cache-dependency-path to the file the job installs so the cache key tracks
the actual lint dependencies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread requirements_lint.txt Outdated
Comment thread README.md Outdated
ludeeus and others added 2 commits July 19, 2026 14:36
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Move pip>=21.3.1 out of requirements_lint.txt into a dedicated
requirements_ci.txt so the lint file holds only the ruff pin. The Lint
workflow installs both files explicitly and hashes both in the pip cache
key. requirements_dev.txt keeps its own pip>=21.3.1 line so local dev still
upgrades pip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

requirements_dev.txt:4

  • pip>=21.3.1 is duplicated between this file and requirements_ci.txt, which undermines the stated goal of avoiding duplication and makes it easy for the pip floor to drift between dev and CI. Consider including requirements_ci.txt from here and removing the duplicated pip entry.

Comment thread .github/workflows/lint.yml Outdated
claude added 2 commits July 19, 2026 13:11
Installing requirements_ci.txt and requirements_lint.txt in one pip
invocation can be flaky, since pip may upgrade itself mid-run. Run the pip
upgrade first, then install the lint tooling, so the upgraded pip is used
for the lint install.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ
…st in dev

The pip pin is common to both the Lint CI job and local dev, so name the file
requirements_common.txt. Install it as a separate first pip command in both
scripts/setup and the Lint workflow, so any pip self-upgrade completes before
the remaining dependencies are installed (guarding dev against the same
mid-run upgrade flakiness as CI). Drop the duplicated pip pin from
requirements_dev.txt now that scripts/setup installs requirements_common.txt
up front.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7aHKodG4TtAS6cgCB2HwZ
@ludeeus
ludeeus force-pushed the claude/lint-requirements-separation-i67en1 branch from a4d14bc to 5e385ee Compare July 19, 2026 13:19
@ludeeus
ludeeus requested a review from Copilot July 19, 2026 13:21

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@ludeeus
ludeeus merged commit d3a431f into main Jul 19, 2026
7 checks passed
@ludeeus
ludeeus deleted the claude/lint-requirements-separation-i67en1 branch July 19, 2026 13:27
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