Skip to content

chore: validate SPDX headers without rewriting files - #271

Merged
mwyau merged 1 commit into
mainfrom
chore/consistent-spdx-headers-20261025
Oct 25, 2026
Merged

mwyau merged 1 commit into
mainfrom
chore/consistent-spdx-headers-20261025

Conversation

@mwyau

@mwyau mwyau commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Why

The existing SPDX pre-commit hook runs reuse annotate, which may rewrite files when committing. Header validation should be read-only and behave the same locally and in CI.

What changed

  • Replace the local annotation hook with SPDX Header Check v0.1.0. Developers run it through prek; CI uses the published GitHub Action.
  • Add missing SPDX headers to the benchmark runner, Sphinx configuration, and TrackJSON schema generator.
  • Restore 12 test-package __init__.py files to zero bytes rather than leaving header-only files.
  • Run the remaining pre-commit checks in CI: JSON/TOML/YAML validation, merge-conflict detection, whitespace/line-ending/EOF/BOM checks, and mdformat. Ruff, ty, mypy, and TrackJSON validation retain their dedicated steps.
  • Add uv lock --check and update ty to 0.0.91 consistently in the pre-commit hook, project dependencies, CI command, and regenerated uv.lock.

The SPDX checker validates headers without adding metadata, changing license identifiers, or updating copyright years. There are no changes to scientific code or algorithms.

Local checks

uvx prek run --all-files
uv lock --check

@mwyau mwyau closed this Oct 25, 2026
@mwyau
mwyau force-pushed the chore/consistent-spdx-headers-20261025 branch from 236dbae to 569f5b2 Compare October 25, 2026 17:34
@mwyau mwyau reopened this Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.16%. Comparing base (569f5b2) to head (b4d75a7).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   78.16%   78.16%           
=======================================
  Files          59       59           
  Lines        9664     9664           
  Branches     1884     1884           
=======================================
  Hits         7554     7554           
  Misses       1374     1374           
  Partials      736      736           
Flag Coverage Δ
integration 51.33% <ø> (ø)
parity 17.06% <ø> (ø)
unit 57.00% <ø> (ø)
unit-jit-coverage 72.36% <ø> (ø)
unit-jit-disabled 73.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@mwyau
mwyau force-pushed the chore/consistent-spdx-headers-20261025 branch from 63dbe7a to b0e6ed3 Compare October 25, 2026 19:02
@mwyau mwyau changed the title Standardize SPDX headers across first-party sources Use shared read-only SPDX header checker Oct 25, 2026
@mwyau mwyau changed the title Use shared read-only SPDX header checker chore: enforce REUSE-style SPDX headers using shared check hook Oct 25, 2026
@mwyau
mwyau force-pushed the chore/consistent-spdx-headers-20261025 branch 2 times, most recently from c8f2908 to a0b2071 Compare October 25, 2026 20:47
@mwyau mwyau changed the title chore: enforce REUSE-style SPDX headers using shared check hook chore: validate SPDX headers without rewriting files Oct 25, 2026
@mwyau
mwyau force-pushed the chore/consistent-spdx-headers-20261025 branch 3 times, most recently from 8b328ec to a3e3181 Compare October 25, 2026 21:08
Use the shared SPDX checker as a hook locally and a GitHub Action in CI.
Run remaining pre-commit checks in CI with selective hooks, retain native
Ruff, lockfile and type checks, and preserve empty test markers.
@mwyau
mwyau force-pushed the chore/consistent-spdx-headers-20261025 branch from a3e3181 to b4d75a7 Compare October 25, 2026 21:13
@mwyau
mwyau requested a lite review from Copilot October 25, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues were identified, and all review assessments indicate approval readiness.

No open issues 🎉

What changed in this PR

This pull request replaces mutating SPDX annotation with read-only header validation, aligns local and CI checks, updates ty, and adds or removes SPDX headers as appropriate without changing scientific code.

Changes:

  • Replaces reuse annotate with spdx-header-check locally and in CI.
  • Adds housekeeping, lockfile, Markdown, type-checking, schema, and SPDX validation steps.
  • Updates ty to 0.0.91 and refreshes uv.lock.
  • Adds headers to uncovered source files while keeping empty test package initializers empty.
File Description
uv.lock Updates the lock revision and pins ty 0.0.91.
tests/​unit/​simple/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​preprocessing/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​models/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​io/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​hodges/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​healpix/​__init__.py Keeps the empty package initializer empty.
tests/​unit/​__init__.py Keeps the empty package initializer empty.
tests/​parity/​ncl_spherepack/​__init__.py Keeps the empty package initializer empty.
tests/​parity/​legacy/​__init__.py Keeps the empty package initializer empty.
tests/​parity/​__init__.py Keeps the empty package initializer empty.
tests/​integration/​__init__.py Keeps the empty package initializer empty.
tests/​__init__.py Keeps the empty package initializer empty.
scripts/​generate_trackjson_schema.py Adds the required SPDX header.
pyproject.toml Updates the development ty dependency to 0.0.91.
docs/​conf.py Adds the required SPDX header.
benchmarks/​run_benchmark_detailed.py Adds the required SPDX header.
.pre-commit-config.yaml Replaces the mutating SPDX hook with the read-only checker and updates ty.
.github/​workflows/​ci.yml Adds housekeeping, lockfile, type-checking, and SPDX validation steps.

Review effort: Lite

@mwyau
mwyau merged commit 60b522b into main Oct 25, 2026
24 checks passed
@mwyau
mwyau deleted the chore/consistent-spdx-headers-20261025 branch October 25, 2026 21:19
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.

2 participants