Skip to content

maint #290 unify copyright automation#291

Merged
prjemian merged 2 commits into
mainfrom
290-unify-copyright-automation
May 26, 2026
Merged

maint #290 unify copyright automation#291
prjemian merged 2 commits into
mainfrom
290-unify-copyright-automation

Conversation

@prjemian
Copy link
Copy Markdown
Collaborator

@prjemian prjemian commented May 25, 2026

Summary

Unify copyright automation in this repo and establish the reference
implementation for the parallel work in bluesky/hklpy2#411 and
prjemian/hklpy2_solvers#112.

Changes

Configuration

  • .copyright.txt: year-range form (2026-2026), SPDX identifier
    LicenseRef-UChicago-Argonne-LLC-License.
  • pyproject.toml: license field switched to
    LicenseRef-UChicago-Argonne-LLC-License.
  • LICENSE line 1: year-range form 2026-2026. Body unchanged
    (verbatim per ANL legal).
  • docs/source/conf.py: static year-range string
    "2026-2026, UChicago Argonne, LLC" (no more f"2026, {author}").
    Bump script keeps the end year fresh.

New: bump script and hook

  • scripts/update_copyright_year.py: rewrites
    <START>-<OLD_END><START>-<CURRENT_YEAR> in
    TARGET_FILES = [.copyright.txt, LICENSE, docs/source/conf.py].
    Exits non-zero when it changes anything so pre-commit fails until
    the developer stages the rewrite.
  • .pre-commit-config.yaml:
    • New local hook update-copyright-year
      (always_run: true, pass_filenames: false).
    • New insert-license (scripts) hook instance covering scripts/*.py.

Header propagation

  • Every covered .py file (61 files) had its header rewritten by
    insert-license to match the new .copyright.txt. This is the
    expected bulk diff; no logic changed.

Documentation

  • AGENTS.md: new "Copyright handling" section explaining the three
    coordinated mechanisms (.copyright.txt + insert-license, the
    bump script, static Sphinx conf.py), what to edit by hand, and
    what not to.
  • CHANGES.md: one-line ### Maintenance entry inside the unreleased
    HTML-comment block, referencing (#290).

Verification

  • pre-commit run --all-files — all hooks pass.
  • pytest -q — 2580 passed, 2 skipped, 100% coverage maintained.
  • Bump script sanity run — exits 0 (no-op; all year ranges already
    current).

SPDX identifier change (PyPI metadata impact)

The License-Expression field on PyPI will visibly change from
LicenseRef-ANL-Open-Source-License to
LicenseRef-UChicago-Argonne-LLC-License on the next release.
Acceptable per the issue discussion: this is a LicenseRef-* custom
identifier authored by the project owner, the licence text in LICENSE
is unchanged, and the new identifier aligns with bluesky/hklpy2 and
prjemian/hklpy2_solvers.

Cross-repo follow-up

This branch finalises the reference implementation. Parallel issues
will port the (now finalised) scripts/update_copyright_year.py,
.copyright.txt + insert-license config, and Sphinx conf.py
pattern to:

Agent: OpenCode (claudeopus47)

* Convert .copyright.txt to year-range form (2026-2026) and switch
  SPDX identifier to LicenseRef-UChicago-Argonne-LLC-License.
* Update pyproject.toml license field to match.
* Convert LICENSE line 1 to year-range form; body unchanged (verbatim
  per ANL legal).
* Add scripts/update_copyright_year.py reference implementation; rolls
  year-range end-year forward in .copyright.txt, LICENSE line 1, and
  docs/source/conf.py.
* Register update-copyright-year as a local pre-commit hook
  (always_run, pass_filenames: false).
* Extend insert-license hook to cover scripts/*.py.
* Set docs/source/conf.py copyright to a static year-range string
  using UChicago Argonne, LLC; bump script maintains it.
* Propagate the new header to all covered .py files.
* Document the three-mechanism copyright handling in AGENTS.md.
* Add Maintenance entry to CHANGES.md.

Agent: OpenCode (claudeopus47)
@prjemian prjemian self-assigned this May 25, 2026
prjemian added a commit to bluesky/hklpy2 that referenced this pull request May 26, 2026
* 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)
Match the one-line release-note style adopted in
bluesky/hklpy2#411 and prjemian/hklpy2_solvers#112.

Agent: OpenCode (claudeopus47)
@prjemian prjemian merged commit 4c7bce0 into main May 26, 2026
7 checks passed
@prjemian prjemian deleted the 290-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

1 participant