Conversation
This workflow installs Python dependencies, runs tests, and lints code with multiple Python versions.
There was a problem hiding this comment.
Pull request overview
Adds a requirements.txt and a basic GitHub Actions workflow to install dependencies, lint, and run pytest—likely to ensure CI can run without relying on Poetry-only installs.
Changes:
- Added
requirements.txtwithrequestsandpydantic<2 - Added
.github/workflows/python-package.ymlto run linting and pytest on Python 3.9–3.11
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| requirements.txt | Introduces a pip requirements file for CI/local installs |
| .github/workflows/python-package.yml | Adds a GitHub Actions workflow for dependency install, flake8, and pytest |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install flake8 pytest | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
There was a problem hiding this comment.
The requirements install uses pip install -r requirements.txt instead of python -m pip install -r requirements.txt. With a version matrix, calling pip directly can target a different interpreter than the one set up by actions/setup-python, leading to hard-to-debug CI failures.
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi |
| python -m pip install flake8 pytest | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Lint with flake8 | ||
| run: | | ||
| # stop the build if there are Python syntax errors or undefined names | ||
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
| - name: Test with pytest | ||
| run: | | ||
| pytest |
There was a problem hiding this comment.
This repo already defines dependencies via Poetry (pyproject.toml/poetry.lock) and the existing CI workflow installs via poetry install. Installing from a hand-maintained requirements.txt here risks the GitHub Actions test environment diverging from the packaged library’s dependency set. Consider switching this workflow to poetry install (or at least python -m pip install . for runtime deps plus a separate dev/test requirements export) to keep CI aligned with the lockfile.
| python -m pip install flake8 pytest | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| run: | | |
| pytest | |
| python -m pip install poetry | |
| poetry install --no-interaction --no-ansi | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| run: | | |
| poetry run pytest |
No description provided.