You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sub-issue - Enforcement (pre-commit + CI pipeline)
Description
Turn the tooling configured in PR A into enforced gates: wire Ruff/mypy/bandit into pre-commit
for local checks, and add the GitHub Actions CI pipeline (plus a lightweight pre-merge workflow) that
blocks merges on failing checks. This is the second of three PRs (A → B → C) and depends on PR A
being merged first (it consumes the pyproject.toml tool config and the seeded CHANGELOG.md).
Out of scope (PR C): the autodoc / docstring-backfill / MyST overhaul, the docs-build CI job, and
enabling the Ruff D rule.
⚠️The Ruff D (docstring) rule stays excluded here too — it is only switched on in PR C once
docstrings are backfilled. CI and pre-commit run Ruff without it.
The changelog gate is safe in this PR because CHANGELOG.md already exists from PR A.
Tasks
1. Pre-commit migration (.pre-commit-config.yaml)
Remove the black, isort, flake8 and pyupgrade hooks.
Drop check-manifest (auto-discovery + package-data from PR A makes MANIFEST unnecessary).
Keep pyproject-fmt, the pre-commit-hooks block, and the existing ci: block.
2. CI pipeline (.github/workflows/ci.yml)
Copy ci.yml from the template, adapted to PQuantML's package/layout.
Set triggers to push on ["main", "dev"] + pull_request (every PR regardless of target). main is included so the eventual dev → main release-promotion PR and the released commit are gated.
Run the pytest job as a matrix: KERAS_BACKEND (tensorflow, torch) × python-version (3.10, 3.11, 3.12) — 6 combos. Each job sets the KERAS_BACKEND env var and installs the matching backend (pip install -e ".[test,tensorflow]" / ".[test,torch]"), mirroring tests/run_tests.sh.
Include jobs: changelog, ruff (check + format, D excluded), mypy, bandit, coverage (enforces fail_under from PR A), nbmake, and the ci-ok gate.
changelog job requires every PR to touch CHANGELOG.md (bypassable via a skip-changelog label).
Point dev branch protection's single required status check at CI · all checks passed (ci-ok).
Add pre-merge.yml — the lighter subset (ruff / mypy / bandit / pytest), backend-adapted, without coverage or notebooks. Runs on pushes to feature branches (branches-ignore: [dev, main]) for fast pre-PR feedback.
Acceptance Criteria
.pre-commit-config.yaml uses ruff-check/ruff-format, mypy, bandit, nbstripout; black/isort/flake8/pyupgrade/check-manifest are removed.
pytest and KERAS_BACKEND=torch pytest both collect and run cleanly with zero import/collection errors (irrelevant modules reported as skipped, not errored); channels_last is still exercised; run_tests.sh is gone.
pre-commit run --all-files passes on a clean tree (Ruff D rule not active).
ci.yml and pre-merge.yml exist and trigger correctly (CI on PRs to dev + pushes to dev; pre-merge on feature-branch pushes, ignoring dev/main).
The pytest job runs the full KERAS_BACKEND × python-version matrix and installs the matching backend extra.
CI jobs present: changelog, ruff, mypy, bandit, coverage, nbmake, ci-ok.
mypy src tests and bandit -c pyproject.toml -r src/ -ll run as blocking checks (with any agreed per-module mypy overrides to reach first-green).
The coverage job enforces fail_under = 60.
The changelog job passes on a normal PR (because CHANGELOG.md exists) and can be bypassed with the skip-changelog label.
Branch protection requires the CI · all checks passed check.
pre-merge.yml runs ruff/mypy/bandit/pytest only (no coverage, no notebooks).
Sub-issue - Enforcement (pre-commit + CI pipeline)
Description
Turn the tooling configured in PR A into enforced gates: wire Ruff/mypy/bandit into pre-commit
for local checks, and add the GitHub Actions CI pipeline (plus a lightweight pre-merge workflow) that
blocks merges on failing checks. This is the second of three PRs (A → B → C) and depends on PR A
being merged first (it consumes the
pyproject.tomltool config and the seededCHANGELOG.md).Scope = sub-issues 2 (pre-commit migration) and 3 (CI pipeline + pre-merge).
Out of scope (PR C): the autodoc / docstring-backfill / MyST overhaul, the docs-build CI job, and
enabling the Ruff
Drule.Tasks
1. Pre-commit migration (
.pre-commit-config.yaml)astral-sh/ruff-pre-commit(ruff-check --fix,ruff-format).pre-commit/mirrors-mypy(argssrc tests,pass_filenames: false,additional_dependencies: [types-setuptools]).PyCQA/bandit(-c pyproject.toml -ll,files: ^src/).kynan/nbstripout(strip notebook outputs).check-manifest(auto-discovery + package-data from PR A makes MANIFEST unnecessary).pyproject-fmt, thepre-commit-hooksblock, and the existingci:block.2. CI pipeline (
.github/workflows/ci.yml)ci.ymlfrom the template, adapted to PQuantML's package/layout.pushon["main", "dev"]+pull_request(every PR regardless of target).mainis included so the eventualdev → mainrelease-promotion PR and the released commit are gated.KERAS_BACKEND(tensorflow,torch) ×python-version(3.10,3.11,3.12) — 6 combos. Each job sets theKERAS_BACKENDenv var and installs the matching backend (pip install -e ".[test,tensorflow]"/".[test,torch]"), mirroringtests/run_tests.sh.changelog,ruff(check + format,Dexcluded),mypy,bandit,coverage(enforcesfail_underfrom PR A),nbmake, and theci-okgate.changelogjob requires every PR to touchCHANGELOG.md(bypassable via askip-changeloglabel).devbranch protection's single required status check atCI · all checks passed(ci-ok).3. Pre-merge workflow (
.github/workflows/pre-merge.yml)pre-merge.yml— the lighter subset (ruff / mypy / bandit / pytest), backend-adapted, without coverage or notebooks. Runs on pushes to feature branches (branches-ignore: [dev, main]) for fast pre-PR feedback.Acceptance Criteria
.pre-commit-config.yamluses ruff-check/ruff-format, mypy, bandit, nbstripout; black/isort/flake8/pyupgrade/check-manifest are removed.pytestandKERAS_BACKEND=torch pytestboth collect and run cleanly with zero import/collection errors (irrelevant modules reported as skipped, not errored);channels_lastis still exercised;run_tests.shis gone.pre-commit run --all-filespasses on a clean tree (RuffDrule not active).ci.ymlandpre-merge.ymlexist and trigger correctly (CI on PRs todev+ pushes todev; pre-merge on feature-branch pushes, ignoringdev/main).KERAS_BACKEND × python-versionmatrix and installs the matching backend extra.changelog,ruff,mypy,bandit,coverage,nbmake,ci-ok.mypy src testsandbandit -c pyproject.toml -r src/ -llrun as blocking checks (with any agreed per-module mypy overrides to reach first-green).fail_under = 60.changelogjob passes on a normal PR (becauseCHANGELOG.mdexists) and can be bypassed with theskip-changeloglabel.CI · all checks passedcheck.pre-merge.ymlruns ruff/mypy/bandit/pytest only (no coverage, no notebooks).