Fix CI: install dependencies via Poetry instead of bare pip#3
Fix CI: install dependencies via Poetry instead of bare pip#3
Conversation
Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions “Python package” workflow to use Poetry for dependency installation so lint/test steps run with the full set of project (runtime + dev) dependencies defined in pyproject.toml, addressing the CI failure caused by missing runtime deps during flake8.
Changes:
- Install Poetry in the workflow before dependency installation.
- Replace direct
pip install flake8 pytest(andrequirements.txtfallback) withpoetry install --with dev. - Run
flake8andpytestviapoetry runto ensure they execute inside the Poetry environment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install Poetry | ||
| run: pip install poetry |
There was a problem hiding this comment.
CI installs Poetry with an unpinned pip install poetry. This makes the workflow non-reproducible and can break the matrix unexpectedly when Poetry releases a version incompatible with one of the Python versions. Elsewhere in this repo CI pins Poetry (e.g., .github/workflows/run_ci.yml installs poetry==2.1.2) and upgrades pip first; consider doing the same here and using python -m pip ... to ensure Poetry is installed into the matrix Python environment.
| run: pip install poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install "poetry==2.1.2" |
The workflow was failing with
ModuleNotFoundError: No module named 'requests'duringflake8because onlyflake8andpytestwere installed via pip, bypassing Poetry and leaving runtime dependencies (requests) absent.Changes
pip install flake8 pytestwithpoetry install --with dev, which installs all runtime and dev dependencies frompyproject.tomlflake8andpytestinvocations withpoetry runto execute inside the Poetry virtual environmentrequirements.txtfallback — redundant givenpyproject.tomlis the source of truthOriginal prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.