Add reproducible Python quality checks and CI lint job - #54
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
pyproject.tomlwith Black, isort and mypy settings (Python target, excludes, mypy plugin and selective error suppression)..pre-commit-config.yamlwith pinned hooks forblack,isort,flake8, andmypyto enable local pre-commit enforcement.lintjob to.github/workflows/ci.ymlthat runsblack --check,isort --check-only,flake8andmypybefore the existing backend/frontend jobs.isort/blackand apply formatting/import fixes to several backend files so the new checks pass (notable files:app/api/v1/links.py,app/api/v1/analytics.py,app/api/v1/users.py,app/models/link.py,app/models/analytics.py,app/models/audit_log.py,app/config.py,app/database/base.py,migrations/versions/0001_initial_schema.py).Testing
python -m black --check app tests migrations && python -m isort --check-only app tests migrations && python -m flake8 app tests migrations --max-line-length=88 --extend-ignore=E203,W503 --exclude=.git,__pycache__,.mypy_cache,.pytest_cache,.venv,build,dist,node_modules && python -m mypy --config-file pyproject.tomland the checks passed after applying formatting and adjusting mypy configuration.python -m pytestand all tests passed (26 passed).python -m pre_commit run --all-filesafter installingpre-commit, but installation was blocked in this environment due to the package index returning403, so the pre-commit hooks could not be exercised end-to-end here.Codex Task