Skip to content

Fix CI: install project dependencies before lint/test#1

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-linting-job-dependency
Open

Fix CI: install project dependencies before lint/test#1
Copilot wants to merge 2 commits intomainfrom
copilot/fix-linting-job-dependency

Conversation

Copy link

Copilot AI commented Mar 2, 2026

CI was failing because deepl/http_client.py imports requests, which is declared in pyproject.toml as a runtime dependency but was never installed — the workflow only installed flake8 and pytest.

Changes

  • .github/workflows/python-package.yml: Added pip install -e . to the install step, so the project and its declared dependencies (including requests) are available before linting and testing across all matrix Python versions (3.9–3.11).
- name: Install dependencies
  run: |
    python -m pip install --upgrade pip
    python -m pip install flake8 pytest
    if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    pip install -e .
Original prompt

Fix GitHub Actions job failure in AKB0700/deepl-python where the workflow fails during linting due to missing dependency requests.

Context:

Task:

  1. Update the repository so CI installs runtime dependencies before running flake8/pytest.
  2. Prefer the correct packaging approach:
    • Ensure requests is declared as a dependency (e.g., in pyproject.toml dependencies, or setup.cfg/setup.py install_requires), and/or ensure requirements.txt includes requests.
    • Update .github/workflows/python-package.yml to install the project itself (e.g., pip install -e . or pip install .) so declared dependencies are installed.
  3. Keep changes minimal and aligned with standard Python packaging practices.
  4. Verify the workflow will succeed across matrix Python versions (3.9-3.11).

Deliverable:

  • Open a PR against base branch main with the necessary changes.
  • Include a clear PR title and description explaining the root cause and the fix.

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.

…ests dependency

Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions job failure due to missing requests dependency Fix CI: install project dependencies before lint/test Mar 2, 2026
@AKB0700 AKB0700 marked this pull request as ready for review March 2, 2026 20:12
Copilot AI review requested due to automatic review settings March 2, 2026 20:12
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

This PR fixes a CI failure in the GitHub Actions workflow where flake8 was failing due to a missing requests module — a runtime dependency declared in pyproject.toml but not installed before linting/testing.

Changes:

  • Added pip install -e . to the GitHub Actions install step so the project's declared runtime dependencies (including requests) are available during lint and test runs.

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

python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
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.

The pip install -e . command uses Poetry's build backend, which only installs the main [tool.poetry.dependencies] (i.e., requests). It does not install the [tool.poetry.group.dev.dependencies] group, which includes pydantic. However, pydantic is imported in tests/conftest.py (from pydantic import BaseSettings), so pytest will still fail with a ModuleNotFoundError: No module named 'pydantic' when importing the test configuration.

The canonical approach used by the project's GitLab CI (in .gitlab-ci.yml) is to install Poetry itself and then run poetry install, which installs all dependency groups including dev. The GitHub Actions workflow should use the same approach:

  1. Install Poetry via pip install poetry
  2. Run poetry install (or poetry install -E keyring if the keyring extra is needed)
  3. Use poetry run flake8 ... and poetry run pytest (or activate the virtual environment Poetry creates) for the lint and test steps.

Alternatively, if keeping the pip-only approach, pydantic (and other dev dependencies) must be explicitly installed, e.g. pip install pydantic pytest-....

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