Skip to content

PyDoctor 2.3.0: built for CI - Release 2.3.0 - #4

Merged
iamAgbaCoder merged 4 commits into
mainfrom
release-2.3.0
Oct 31, 2026
Merged

iamAgbaCoder merged 4 commits into
mainfrom
release-2.3.0

Conversation

@iamAgbaCoder

Copy link
Copy Markdown
Owner

PyDoctor 2.3.0: built for CI

2.2.0 made pydoctor's results trustworthy. 2.3.0 makes them usable in CI: existing projects can adopt it without a wall of failures, and findings show up where code is reviewed.

Baselines

A project with 89 known vulnerabilities can't turn on a gate that fails on every run. pydoctor baseline records today's issues in .pydoctor-baseline.json; scans then hide them and fail only on new ones.

  • Auto-loaded when present; --baseline FILE / --no-baseline on every scan command; pydoctor baseline --ci updates only CI-guard entries
  • Stable matching: vulnerabilities by package + advisory (not installed version); secrets and workflow findings by file + hash of the line, so adding lines above a known secret doesn't make it "new"; outdated/unused by package
  • Never baselined: ENV_PACKAGES_UNAVAILABLE, SEC_SCAN_INCOMPLETE, SCANNER_ERROR. Accepting them would turn a scan that didn't run into a pass
  • Reports when baselined issues are fixed (only for categories the scan actually checked)
  • The file holds codes, severities and titles, never secret previews

Tested end to end: baseline 8 findings → exit 0; shift lines and add a new GitHub token → only the token is reported, exit 1; remove a baselined secret → "1 baselined issue is fixed".

SARIF

--sarif FILE on every scan command. Validated against the OASIS SARIF 2.1.0 schema.

  • One rule per advisory (GHSA/PYSEC id) with the CVSS score as security-severity and an OSV link, so GitHub ranks alerts correctly
  • Package findings point at the declaring line in pyproject.toml / requirements*.txt; secrets and workflow findings at their file and line; paths relative to the git root (works for subdirectory projects)
  • Environment findings and broken-scan issues are left out (they describe the runner, not the code)
  • partialFingerprints reuse the baseline fingerprint, so alerts stay stable across runs

GitHub Action

uses: iamAgbaCoder/pydoctor-cli@v2

  • Installs pydoctor in its own venv, so it neither changes nor is counted in the project's environment
  • Version follows the ref: @v2 → latest 2.x, @v2.3.0 → exactly 2.3.0, or set version
  • Writes SARIF, uploads to code scanning (non-fatal where code scanning isn't available), then fails the job on findings; exit-code and sarif-file outputs
  • A self-scan workflow runs the action from this repo on every PR
  • actionlint clean; install and scan scripts covered by tests

pre-commit

  • pydoctor-ci: blocks commits that add secrets, .env files or risky workflows. Isolated, no network. Verified with pre-commit try-repo: a staged Stripe key fails the hook, removing it passes
  • pydoctor-check: full scan at pre-push, using the user's own pydoctor

Docs links

Every issue has docs_url in JSON (and SARIF helpUri); errors and criticals show a Docs line in the terminal. A test pins every anchor to headings that exist on pydoctor-docs.thally.app.

Release workflow

publish.yml now triggers on v*.*.* tags only, so moving the v2 tag for the action doesn't create a PyPI release or a GitHub release named "v2".

Testing

  • 138 tests (26 new) on Python 3.10, 3.11, 3.12, 3.13; ruff, black, mypy clean
  • Wheel built and smoke-tested (baseline + SARIF on the lab project)
  • Not run here: the action on real GitHub runners. The self-scan workflow in this PR is that test.

After merging

  1. Tag v2.3.0 and push it (publishes to PyPI)
  2. Create the moving major tag: git tag -f v2 v2.3.0 && git push -f origin v2
  3. Check the self-scan workflow run and the Security → Code scanning tab
  4. Optional: publish the action to the GitHub Marketplace from the v2.3.0 release page

Baselines
- `pydoctor baseline` records current issues in .pydoctor-baseline.json;
  scans hide them and fail only on new issues. `--ci` updates only CI
  guard entries and keeps the rest.
- Auto-loaded when present; --baseline FILE / --no-baseline on every
  scan command. Unreadable or wrong-format files exit 2.
- Fingerprints are stable: vulnerabilities by package + advisory (not
  installed version), file findings by file + hash of the line (survive
  line shifts), outdated packages by name.
- Scan-integrity issues (ENV_PACKAGES_UNAVAILABLE, SEC_SCAN_INCOMPLETE,
  SCANNER_ERROR) are never baselined. Fixed entries are reported, only
  for categories the scan checked. The file holds no secret previews.

SARIF
- --sarif FILE on every scan command writes SARIF 2.1.0 (validated
  against the OASIS schema). One rule per advisory with CVSS-based
  security-severity and an OSV link; one rule per code otherwise.
- Package findings point at the declaring line in pyproject.toml or
  requirements*.txt; file findings at their file and line; paths are
  relative to the git root. Environment and broken-scan issues are left
  out. partialFingerprints use the baseline fingerprint.

Docs links
- Every issue has docs_url (JSON) and errors/criticals show a Docs line
  in the terminal, pointing at pydoctor-docs.thally.app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVyXTHZGXqyzPFrUPGPkpX
GitHub Action (action.yml, composite)
- Installs pydoctor in its own venv, so it doesn't change or get counted
  in the project's environment; the version follows the action ref
  (v2 → latest 2.x, v2.3.0 → exactly that) unless `version` is set
- Runs `pydoctor check` (or the CI guard only), writes SARIF, uploads it
  to code scanning (non-fatal if code scanning isn't available), then
  fails the job on findings; exit code and SARIF path are outputs
- Self-scan workflow runs the action from this repo on every PR
- actionlint clean; scripts covered by tests

pre-commit
- pydoctor-ci: blocks commits that add secrets, .env files or risky
  workflows; isolated, no network needed
- pydoctor-check: full scan with your own pydoctor at pre-push

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVyXTHZGXqyzPFrUPGPkpX
Only full version tags (v2.3.0) publish to PyPI, so a moving v2 tag for
the GitHub Action doesn't trigger a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVyXTHZGXqyzPFrUPGPkpX
@iamAgbaCoder iamAgbaCoder self-assigned this Oct 31, 2026
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

On Windows runners `bash` on PATH resolves to WSL, which can't read the
Windows paths the tests pass, so all seven tests failed there. The
action itself runs under Git Bash on Windows; install.sh now converts
RUNNER_TEMP with cygpath so the venv path works there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVyXTHZGXqyzPFrUPGPkpX
@iamAgbaCoder
iamAgbaCoder merged commit 88112a1 into main Oct 31, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants