ci: add pytest job for minimum dependency versions#2080
Conversation
Add a new CI job 'pytest-min-deps' that installs the lowest allowed versions of direct dependencies (as declared in pyproject.toml) using uv's --resolution=lowest-direct flag, then runs the test suite. This ensures the declared minimum version bounds are actually compatible with the library. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new ChangesMinimal Dependency Testing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a dedicated CI job to run the test suite against the lowest allowed versions of direct dependencies, helping ensure the package remains compatible with its declared dependency floors.
Changes:
- Add new
pytest-min-depsjob to.github/workflows/tests.yaml. - Install dependencies via
uv pip install --resolution=lowest-directand run pytest on the oldest supported Python (3.11).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: 🏗 Install dependencies (minimum versions) | ||
| run: > | ||
| uv pip install --system --resolution=lowest-direct | ||
| -e ".[cli]" | ||
| aioresponses pytest pytest-asyncio pytest-cov covdefaults syrupy |
| - name: 🚀 Run pytest | ||
| run: pytest tests |
- Split dependency install into two steps: project with --resolution=lowest-direct, test tools installed separately to avoid applying lowest-direct to pytest/aioresponses/etc. - Add --no-cov to pytest invocation to override pyproject.toml addopts = "--cov" since this job doesn't collect coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/tests.yaml (1)
59-62: 💤 Low valueConsider adding cache for uv to improve CI performance.
The main
pytestjob usescache: "poetry"(line 35), but this job has no caching configured. You could addcache: "pip"here to cache uv's dependencies, which would speed up subsequent runs.⚡ Proposed optimization
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + cache: "pip"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/tests.yaml around lines 59 - 62, Add caching for the Python dependencies used by the job that sets up Python (the step using actions/setup-python with env.DEFAULT_PYTHON) by adding cache: "pip" to that job definition; specifically, update the job that contains the "🛠 Set up Python ${{ env.DEFAULT_PYTHON }}" step to include a top-level cache: "pip" entry (similar to the other pytest job's cache: "poetry") so uv's dependencies are cached between CI runs and speed up subsequent jobs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/tests.yaml:
- Around line 67-68: The CI step named "🏗 Install test dependencies" currently
installs pytest and plugins but omits pytest-cov, causing pytest to fail due to
the project-wide addopts = "--cov" in pyproject.toml; update the run command in
that step to include pytest-cov alongside pytest, pytest-asyncio, aioresponses,
and syrupy so the coverage option is available to pytest during the workflow.
---
Nitpick comments:
In @.github/workflows/tests.yaml:
- Around line 59-62: Add caching for the Python dependencies used by the job
that sets up Python (the step using actions/setup-python with
env.DEFAULT_PYTHON) by adding cache: "pip" to that job definition; specifically,
update the job that contains the "🛠 Set up Python ${{ env.DEFAULT_PYTHON }}"
step to include a top-level cache: "pip" entry (similar to the other pytest
job's cache: "poetry") so uv's dependencies are cached between CI runs and speed
up subsequent jobs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d945aa0-a871-424f-86f5-8553f44f79c4
📒 Files selected for processing (1)
.github/workflows/tests.yaml
pytest-cov must be installed even when --no-cov is passed, because pyproject.toml addopts = "--cov" causes pytest to load the plugin on startup before --no-cov can take effect. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| - name: 🏗 Install package (minimum dependency versions) | ||
| run: uv pip install --system --resolution=lowest-direct -e ".[cli]" | ||
| - name: 🏗 Install test dependencies | ||
| run: uv pip install --system aioresponses pytest pytest-asyncio pytest-cov syrupy |
| - name: 🏗 Install test dependencies | ||
| run: uv pip install --system aioresponses pytest pytest-asyncio pytest-cov syrupy |
Summary
Adds a new CI job
pytest-min-depsthat verifies the library works with the lowest allowed versions of its direct dependencies, as declared inpyproject.toml.Motivation
The existing CI always installs the latest compatible dependency versions via
poetry install. This means the declared minimum version bounds (e.g.aiohttp>=3.0.0,yarl>=1.6.0) were never actually tested — the library could be incompatible with its own declared minimums without anyone noticing.Related to #2072.
How it works
Uses
uv pip install --resolution=lowest-direct, which automatically resolves to the lowest allowed version of each direct dependency. The job runs on Python 3.11 (the oldest supported version) and is independent from the coverage pipeline.Generated by GitHub Copilot in VS Agent
Summary by CodeRabbit