ENH 4.2|4.3 CI/CD Enhancements: pyproject.toml + linting + pre-commit hooks#16
ENH 4.2|4.3 CI/CD Enhancements: pyproject.toml + linting + pre-commit hooks#16
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the project’s CI/CD pipeline and development setup by organizing dependencies, restoring linting, and adding pre-commit hooks.
- Reorganized
pyproject.toml: moved dev/test dependencies to optional groups, pinned project metadata, and added coverage, mypy, and Ruff configurations. - Enabled Ruff linting in GitHub Actions, running only on changed Python files.
- Added a
.pre-commit-config.yamland updated the README with installation steps, dependency groups, and pre-commit hook setup.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyproject.toml | Split dependencies into core and optional groups; added tooling config (Ruff, coverage, mypy) |
| README.md | Expanded installation instructions, dependency extras, and pre-commit usage docs |
| .pre-commit-config.yaml | New pre-commit hooks for Ruff, formatting, whitespace, and other checks |
| .github/workflows/python-package.yml | Restored and updated the lint job to run Ruff only on changed files |
Comments suppressed due to low confidence (2)
.github/workflows/python-package.yml:45
- The
testjob is indented more deeply than thelintjob underjobs:. It should be aligned at the same level aslint(two spaces underjobs:) to avoid YAML parsing errors.
test:
pyproject.toml:143
- The coverage exclude pattern won’t match the typical Python guard
if __name__ == "__main__":. Update the string to include escaped quotes or a proper regex, e.g.,"if __name__ == \"__main__\"":.
"if __name__ == .__main__.:",
|
Hi @fkiraly , this MR is ready to review. For ease of review, I already made copilot review the code and there are some low profile comments. So, this is ready for your review :) |
fkiraly
left a comment
There was a problem hiding this comment.
CI
- Does the
lintjob run as expected, i.e., it fails if the files are no tlinted?
Would it be perhaps simpler to runpre-commit, given that you have now added a config for it? E.g.,
- name: Run pre-commit on changed files
run: |
if [ -n "$CHANGED_FILES" ]; then
pre-commit run --color always --files $CHANGED_FILES --show-diff-on-failure
else
echo "No changed files to check."
fi
- should
testrun over a wider matrix of python versions? - if you move to
pyproject, then the CI install should also use pyproject and notrequirements.txt - is build needed in the PR CI? I thought this is primarily for release.
pyproject
- looks overall reasonable
- python 3.8 is deprecated, 3.9 is supported
- 3.13 is also a currently released version
- are all the core dependencies needed for base functionality?
Yes, the lint job will fail if the recommit detects any issues in the files changed. Also --show-diff-no-failure will provide clear output output in the CI logs.
This has been integrated now, the lint job would will directly run on pre-commit on changed files.
We are running this only on pyhon 3.12 version (could be expanded over multiple versions if needed lateron)
Yes, now all the CI jobs (lint, test, docs and new build/publish workflows) are using pyproject.toml and uv.
Yes, from the broader pov, this should have been added to a separate workflow apart from the main workflow. Now,
Currently I have set up the CIs for 3.12 version, will it be better to extend to 3.13 as well (or shall we keep this for later update)
Seggregating the minimal set was a little challenging, and based on the errors encountered while running the core workflow, I have added these libraries. If there are any issues in particular, we can discuss about them. |
Changes