Skip to content

Fix CI: install dependencies via Poetry instead of bare pip#3

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-github-actions-workflow
Open

Fix CI: install dependencies via Poetry instead of bare pip#3
Copilot wants to merge 2 commits intomainfrom
copilot/fix-github-actions-workflow

Conversation

Copy link

Copilot AI commented Mar 2, 2026

The workflow was failing with ModuleNotFoundError: No module named 'requests' during flake8 because only flake8 and pytest were installed via pip, bypassing Poetry and leaving runtime dependencies (requests) absent.

Changes

  • Install Poetry in CI before the dependency step
  • Replace pip install flake8 pytest with poetry install --with dev, which installs all runtime and dev dependencies from pyproject.toml
  • Prefix flake8 and pytest invocations with poetry run to execute inside the Poetry virtual environment
  • Remove requirements.txt fallback — redundant given pyproject.toml is the source of truth
- name: Install Poetry
  run: pip install poetry
- name: Install dependencies
  run: poetry install --with dev
- name: Lint with flake8
  run: |
    poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
    poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
  run: |
    poetry run pytest
Original prompt

Create a fix for the failing GitHub Actions workflow in AKB0700/deepl-python.

Context:

Repository findings:

  • The repository uses Poetry, as indicated by pyproject.toml with [tool.poetry] and build backend poetry.core.masonry.api.
  • pyproject.toml declares runtime dependency requests = ">=2.32.5" under [tool.poetry.dependencies], plus dev dependencies including flake8 and pytest under [tool.poetry.group.dev.dependencies].
  • Current workflow .github/workflows/python-package.yml installs only flake8 and pytest via pip and optionally installs requirements.txt if present; it does not install Poetry dependencies from pyproject.toml, so requests is missing.

Task:

  • Update .github/workflows/python-package.yml to correctly install project dependencies using Poetry.
  • Ensure lint (flake8) and tests (pytest) run within the Poetry environment.
  • Keep the existing matrix for Python versions (3.9, 3.10, 3.11) unless a change is required.
  • Prefer minimal, standard changes suitable for CI.

Acceptance criteria:

  • Workflow installs dependencies from pyproject.toml (including requests).
  • flake8 and pytest run successfully in CI.
  • No dependency on requirements.txt is required.

Files involved:

  • pyproject.toml
  • .github/workflows/python-package.yml

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.

Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions workflow to install Poetry dependencies Fix CI: install dependencies via Poetry instead of bare pip Mar 2, 2026
@AKB0700 AKB0700 marked this pull request as ready for review March 2, 2026 20:27
Copilot AI review requested due to automatic review settings March 2, 2026 20:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 (and requirements.txt fallback) with poetry install --with dev.
  • Run flake8 and pytest via poetry run to 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
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
run: pip install poetry
run: |
python -m pip install --upgrade pip
python -m pip install "poetry==2.1.2"

Copilot uses AI. Check for mistakes.
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