Skip to content

maint #411 unify copyright automation#412

Merged
prjemian merged 3 commits into
mainfrom
411-unify-copyright-automation
May 26, 2026
Merged

maint #411 unify copyright automation#412
prjemian merged 3 commits into
mainfrom
411-unify-copyright-automation

Conversation

@prjemian
Copy link
Copy Markdown
Collaborator

Summary

Port the unified copyright-automation system finalised in
BCDA-APS/ad_hoc_diffractometer#291 to this repo, completing the
three-repo trilogy (BCDA-APS/ad_hoc_diffractometer#290,
prjemian/hklpy2_solvers#112, this issue).

This repo already had the year-bump script (scripts/update_copyright_year.py);
this PR adds the .copyright.txt + insert-license per-file-header
propagation it lacked, removes the non-standard
pyproject.toml/[tool.copyright] block, standardises the rendered
docs holder string, and stamps every covered Python and Bash file.

Changes

Configuration

  • .copyright.txt (new): Copyright (c) 2023-2026 UChicago Argonne, LLC
    • SPDX identifier LicenseRef-UChicago-Argonne-LLC-License.
  • .pre-commit-config.yaml: three new insert-license instances:
    • (src+tests) covering ^src/hklpy2/(?!_version)(?!.*/dev_)(?!dev_).*\.py$.
      Tests live inside src/hklpy2/ so are covered here.
    • (scripts-py) covering ^scripts/.*\.py$.
    • (scripts-shell) covering ^scripts/.*\.sh$. Bash uses #
      comments so the same template applies; the hook handles shebangs
      correctly.
  • scripts/update_copyright_year.py TARGET_FILES: dropped
    pyproject.toml, src/hklpy2/__init__.py, and docs/source/index.rst;
    added .copyright.txt, LICENSE, and docs/source/conf.py.
    Docstring file list updated.
  • pyproject.toml: removed the [tool.copyright] block (non-standard
    PEP 621 field; intentionally not used in any of the three repos).
  • docs/source/conf.py: replaced
    copyright = toml["tool"]["copyright"]["copyright"]
    with static copyright = "2023-2026, UChicago Argonne, LLC". Bump
    script maintains the end year. Holder string switched from
    Argonne National Laboratory to UChicago Argonne, LLC for
    cross-repo consistency.
  • docs/source/index.rst: removed the duplicate
    copyright (c) 2023-2026, Argonne National Laboratory row from the
    About table. The Sphinx-rendered footer (driven by conf.py) is
    now the single source.

Stale-year fix

  • LICENSE line 1: bumped from 2023-2025 to 2023-2026 by the bump
    script on its first run with LICENSE in TARGET_FILES. Body
    unchanged (verbatim per ANL legal).

Per-file header propagation

  • src/hklpy2/__init__.py: stripped the 8-line Argonne block; the new
    institutional 2-line header is inserted at the top of the file by
    the hook.
  • 73 other .py files under src/hklpy2/ (including tests in
    src/hklpy2/{,backends/,blocks/}tests/) had headers inserted.
  • src/hklpy2/dev_i182.py intentionally not stamped (excluded by
    regex; dev_* files are developer scratch/experimental code).
  • scripts/release.sh: 2-line header inserted after the
    #!/usr/bin/env bash shebang and before the existing usage block.
  • scripts/update_copyright_year.py: 2-line header inserted after the
    #!/usr/bin/env python3 shebang.

Documentation

  • AGENTS.md: new "Copyright handling" section (between "Inputs &
    outputs" and "Running locally") documenting the three coordinated
    mechanisms, what to edit by hand, and what not to. Notes the
    dev_* exclusion and the Bash coverage.
  • RELEASE_NOTES.rst: one-line Maintenance entry in the existing
    SEMVER block.

Verification

  • pre-commit run --all-files — all hooks pass.
  • pytest -q — 1275 passed, 7 skipped, 0 failed.
  • Bump script sanity run — exits 0 (no-op; all year ranges already
    current).

Cross-repo coordination

Agent: OpenCode (claudeopus47)

* Add .copyright.txt as single source of truth for per-file header
  text: year range 2023-2026, institutional holder UChicago Argonne,
  LLC, SPDX identifier LicenseRef-UChicago-Argonne-LLC-License.
* Add three Lucas-C/insert-license hook instances covering
  src/hklpy2/**/*.py (excluding _version.py and dev_*.py),
  scripts/*.py, and scripts/*.sh.  Tests live inside src/hklpy2/ so
  are covered by the src+tests instance.
* Update scripts/update_copyright_year.py TARGET_FILES: drop
  pyproject.toml and src/hklpy2/__init__.py (now hook-managed),
  drop docs/source/index.rst (copyright row removed), add
  .copyright.txt, LICENSE, and docs/source/conf.py.
* Remove [tool.copyright] block from pyproject.toml (non-standard
  PEP 621 field; .copyright.txt + LICENSE + conf.py are sufficient).
* Replace docs/source/conf.py dynamic-lookup copyright assignment
  with a static year-range string using UChicago Argonne, LLC; bump
  script maintains the end year.
* Remove duplicate copyright row from docs/source/index.rst About
  table; conf.py is now the single source for the rendered docs.
* Strip the 8-line Argonne block from src/hklpy2/__init__.py; the
  new institutional 2-line header is inserted by the hook at the
  top of the file.
* Bump script fixed LICENSE line 1 from 2023-2025 to 2023-2026
  (stale-year drift).
* Stamp every covered .py file in src/hklpy2/, scripts/release.sh,
  and scripts/update_copyright_year.py with the institutional
  2-line header.
* Document the three-mechanism copyright handling in AGENTS.md.
* Add Maintenance entry to RELEASE_NOTES.rst SEMVER block.

Agent: OpenCode (claudeopus47)
@prjemian prjemian self-assigned this May 25, 2026
@checkmarx-gh-ast-us-povs
Copy link
Copy Markdown

checkmarx-gh-ast-us-povs Bot commented May 25, 2026

Logo
Checkmarx One – Scan Summary & Details3f50a6c7-f603-4383-aeb9-9ef3d9465066

Great job! No new security vulnerabilities introduced in this pull request


Communicate with Checkmarx by submitting a PR comment with @Checkmarx followed by one of the supported commands. Learn about the supported commands here.

@coveralls
Copy link
Copy Markdown

coveralls commented May 25, 2026

Coverage Report for CI Build 26471355608

Warning

No base build found for commit b01f5d8 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 100.0%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 3670
Covered Lines: 3670
Line Coverage: 100.0%
Coverage Strength: 4.99 hits per line

💛 - Coveralls

prjemian added 2 commits May 26, 2026 14:47
* Remove dev_* exclusion from insert-license regex.  Confirmed all
  three repos .gitignore dev_*, so such files never reach the hook
  in the first place; the regex was dead code.
* Update AGENTS.md to note that dev_* files are .gitignore-d (the
  actual exclusion mechanism), not regex-excluded.
* Replace scripts/update_copyright_year.py with the canonical text
  from BCDA-APS/ad_hoc_diffractometer#291: ASCII hyphens instead of
  em-dashes, consistent docstring paragraph order, identical body.
  Functionally equivalent; cosmetic alignment only.

Agent: OpenCode (claudeopus47)
Migration artifact from copying scripts/update_copyright_year.py
verbatim from BCDA-APS/ad_hoc_diffractometer and then having
insert-license prepend the local repo's 2023-2026 header on top
of the inherited 2026-2026 header.  insert-license recognises the
top-of-file header but not the duplicate below it.

Agent: OpenCode (claudeopus47)
@prjemian prjemian merged commit cbc905e into main May 26, 2026
14 checks passed
@prjemian prjemian deleted the 411-unify-copyright-automation branch May 26, 2026 19:54
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.

Unify copyright automation across hklpy2, ad_hoc_diffractometer, hklpy2_solvers

2 participants