Fix CI: install project dependencies before lint/test#1
Fix CI: install project dependencies before lint/test#1
Conversation
…ests dependency Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com>
There was a problem hiding this comment.
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 (includingrequests) 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 . |
There was a problem hiding this comment.
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:
- Install Poetry via
pip install poetry - Run
poetry install(orpoetry install -E keyringif the keyring extra is needed) - Use
poetry run flake8 ...andpoetry 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-....
CI was failing because
deepl/http_client.pyimportsrequests, which is declared inpyproject.tomlas a runtime dependency but was never installed — the workflow only installedflake8andpytest.Changes
.github/workflows/python-package.yml: Addedpip install -e .to the install step, so the project and its declared dependencies (includingrequests) are available before linting and testing across all matrix Python versions (3.9–3.11).Original 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.