Skip to content

docs: add citation metadata - #415

Merged
uniqueg merged 6 commits into
devfrom
docs/citation
Oct 22, 2026
Merged

uniqueg merged 6 commits into
devfrom
docs/citation

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Resolves #407 (merged into dev, so the issue is closed by hand).

  • CITATION.cff (CFF 1.2.0): title, abstract, type: software, license: Apache-2.0, repository-code, url (docs), keywords, version: "0.16.0" and date-released: "2026-10-22" (the latest release, tag v0.16.0), and the authors below. The message explains the order and the convention for equal contributors (an asterisk; there are no ties now). No DOI yet (docs: add the Zenodo DOI and badge #412).
  • scripts/citation.py (stdlib only): set X.Y.Z [--date YYYY-MM-DD] sets version and date-released before a release; check X.Y.Z runs in the release workflow, which fails if the file has another version, or a missing, invalid or future date (UTC). Zenodo archives each release with the CITATION.cff of the tagged commit, so the file must be updated in a PR to dev before tagging. README "Releasing" documents this step.
  • CI (lint job) validates the file: pipx run --spec cffconvert==2.0.0 cffconvert --validate. It runs in its own environment because cffconvert 2.0.0 pins jsonschema 3.2. 2.0.0 is the latest stable release; Dependabot doesn't bump it.
  • tests/test_citation.py: tests the script, and checks that the file has no e-mail addresses.
  • docs/contributing.md: new section "Citation metadata", on how contributors add or correct their entry.
  • The same script, tests and structure go to cloud-registry (docs: add citation metadata cloud-registry#180). The script differs only in import order, because the two repos configure isort differently.

Authors

Lines added on main (= v0.16.0), per GitHub account, from git log --numstat. Commits without a GitHub account are matched by name: 5 by "Alex Kanitz" go to uniqueg, and semantic-release is counted as a bot. Not counted:

  • bots (dependabot, semantic-release);
  • the reformat commits in .git-blame-ignore-revs (dc13ead, 8dfb0ca);
  • generated files: uv.lock, Chart.lock, charts/foca-common/tests/__snapshots__/;
  • copied third-party texts: LICENSE, CODE_OF_CONDUCT.md;
  • binary files.

Names and ORCID iDs come from the maintainer's contributor list. Affiliations come only from public ORCID records (see below).

Handle Lines Commits Included Affiliation (source)
uniqueg 39940 123 yes given in #407
kushagra189 7246 16 yes none (no ORCID iD)
sarthakgupta072 2163 13 yes none (no ORCID iD)
stikos 1540 4 yes none (no ORCID iD)
micolous 266 1 yes (1) none (no ORCID iD)
vipulchhabra99 139 2 yes none (2)
alohamora 101 2 yes (3) none (no ORCID iD)
trispera 32 1 no -
anuragxxd 29 2 no -
Rahuljagwani 15 3 no -
lvarin 3 1 no -
LakiG 1 1 no -
  1. 236 of the 266 lines are two new OpenAPI test fixtures (tests/test_files/openapi_3_petstore_pathitemparam.*.yaml). I counted them as authored test data, not vendored files; without them it would be 30 lines (not included).
  2. The public ORCID record (pub.orcid.org) has a single education entry (IIIT Hyderabad) with no dates, so it can't be tied to the contribution period (Feb 2021). Left out as ambiguous.
  3. Just above the threshold: 65 lines of code and tests (fix: register custom config model #189), plus 36 lines of Read the Docs configuration (docs: add Read the Docs config file #186).

Light lane?

No. This changes the release workflow and CI, so the full process applies: adversarial and quality reviewer subagents, and the Sourcery review.

Verification

  • Python 3.11 venv (.[dev], requirements/lint.txt): pytest tests/test_citation.py (42 passed), ruff check, ruff format --check, mypy (now incl. scripts): clean.
  • cffconvert --validate (2.0.0, Python 3.13): valid.
  • python scripts/citation.py check 0.16.0: exit 0. set 0.17.0 --date 2026-11-01 on a copy changes exactly the two lines.
  • mkdocs build --strict: no warnings. editorconfig-checker on the changed files: clean.
  • CI: all checks pass (the new "Validate citation metadata" step included).

Review

Round 1 (adversarial + quality reviewers) found no high findings. Fixed:

  • set silently appended a second key when an existing version/date-released line had another format (block scalar, mismatched quotes, quoted key, # in values). It now fails with an error.
  • check accepted ISO 8601 dates that CFF rejects (e.g. 20261023). Dates must now be YYYY-MM-DD, also for --date.
  • A comment now needs whitespace before #, as in YAML.
  • A failed check after tagging uses up the version, because tags are immutable. The release docs now run python scripts/citation.py check X.Y.Z before tagging, ask for set shortly before the release, and say that each pre-release needs its own citation change.
  • The message and the docs gave different branches. The message is now shorter and points to the docs section, which states the full rule.
  • More tests (invalid --date, duplicate/quoted keys, the hint text, set+check on the real file, an e-mail regex instead of @).
  • Smaller cleanups: no chr(10) trick; comment fixes.
  • scripts/ added to mypy's files.

Round 2 (adversarial reviewer only, as the fixes changed logic): one low finding, fixed. Empty values, and values continued on an indented next line (a YAML plain scalar), are now rejected; before, set rewrote only the first line, or check misread the value.

Sourcery: one finding, fixed (703152b): set now writes CITATION.cff atomically (temporary file, then replace). The same fix and a time-zone-pinned default-date test went to cloud-registry.

Declined review findings

  • Pin cffconvert's transitive dependencies (constraints file): declined. They resolve within cffconvert 2.0.0's own bounds (jsonschema<4 etc.). A constraints file would need manual upkeep, because Dependabot would try to move them past those bounds. The workflow comment says so.
  • date-released is the date of the set change, not of the tag: by design (the file must be committed before tagging). The docs say to run set shortly before the release.
  • Measure scripts/ coverage too: declined. FOCA measures the package (foca) only. The script is fully tested and now type-checked.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Add and enforce release-aware citation metadata for the project.

New Features:

  • Add Citation File Format metadata describing the project, release version, authors, and citation information.

Enhancements:

  • Add a release helper to update and validate citation version and release dates before tagging.
  • Document citation metadata maintenance and the release workflow requirements.

CI:

  • Validate CITATION.cff in CI and verify release metadata in the release workflow.
  • Include release scripts in mypy type checking.

Documentation:

  • Document contributor citation entries and release citation metadata procedures.

Tests:

  • Add coverage for citation metadata validation, release updates, invalid formats, dates, errors, and atomic writes.

uniqueg and others added 4 commits October 23, 2026 00:08
Add CITATION.cff (CFF 1.2.0) for the GitHub citation entry and Zenodo,
with the authors who committed at least 100 lines to main (ordered by
lines, then commits), and describe in the contributing docs how
contributors add or correct their entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Validate CITATION.cff with cffconvert in CI. Add scripts/citation.py to
set version and date-released before a release (Zenodo archives the
file of the tagged commit) and to check them in the release workflow,
which fails if the file has another version; document the step under
Releasing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings: set and check fail on duplicate (also
quoted) or unparsable version/date-released lines instead of appending
a second key; dates must be YYYY-MM-DD; a comment needs whitespace
before #. Document the check before tagging and that each pre-release
needs its own citation change; point the CFF message to the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 review: set and check fail when version or date-released is
empty or continued on an indented next line (a YAML plain scalar),
instead of rewriting only the first line or misreading the value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds validated CFF citation metadata, contributor attribution guidance, and a tested release helper that updates and checks version/date fields. CI validates the schema, while the release workflow prevents tagging when metadata does not match the release or contains a future date.

Sequence diagram for citation metadata release validation

sequenceDiagram
    participant Maintainer
    participant Dev
    participant ReleaseWorkflow
    participant CitationScript
    participant Zenodo

    Maintainer->>CitationScript: set_release(version, date)
    CitationScript-->>Maintainer: Update CITATION.cff
    Maintainer->>Dev: Merge metadata change
    Maintainer->>ReleaseWorkflow: Push release tag
    ReleaseWorkflow->>CitationScript: check_release(version, today)
    alt Metadata matches release
        CitationScript-->>ReleaseWorkflow: Validation succeeds
        ReleaseWorkflow->>Zenodo: Archive tagged commit and CITATION.cff
    else Version or date is invalid
        CitationScript-->>ReleaseWorkflow: Exit with error
        ReleaseWorkflow-->>Maintainer: Release fails
    end
Loading

Flow diagram for citation metadata validation in CI

flowchart LR
    CitationFile[CITATION.cff] --> CFFConvert[cffconvert --validate]
    CitationFile --> CitationTests[tests/test_citation.py]
    CitationTests --> CitationScript[scripts/citation.py]
    CFFConvert --> CI[CI checks]
    CitationTests --> CI
Loading

File-Level Changes

Change Details Files
Adds repository citation metadata and contributor guidance in Citation File Format.
  • Adds CITATION.cff with release metadata, licensing, repository links, keywords, and credited authors.
  • Documents contributor attribution rules and citation metadata maintenance.
CITATION.cff
docs/contributing.md
Introduces a standard-library release metadata tool with validation safeguards.
  • Adds set to update version and release date and check to enforce release-version, date-format, and non-future-date requirements.
  • Preserves unrelated YAML content while rejecting duplicate, malformed, multiline, or unsupported metadata values.
  • Emits GitHub Actions-compatible errors and is covered by focused unit tests, including repository-file and email checks.
scripts/citation.py
tests/test_citation.py
Integrates citation validation into CI and the release process.
  • Runs pinned cffconvert validation in an isolated lint environment.
  • Checks citation version and release date before publishing a tag.
  • Documents the required pre-release metadata update and pre-tag verification steps.
  • Includes scripts/ in mypy coverage.
.github/workflows/checks.yml
.github/workflows/release.yml
README.md
pyproject.toml

Possibly linked issues

  • docs: add citation metadata #407: Link: the PR implements the issue’s citation-metadata work, including CITATION.cff, release checks, CI validation, and contributor guidance.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (da7edde) to head (4335bd8).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #415   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2777      2777           
=========================================
  Hits          2777      2777           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 22, 2026 22:47

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/citation.py" line_range="218" />
<code_context>
+        text = path.read_text(encoding="utf-8")
+        if args.command == "set":
+            text = set_release(text, args.version, args.date or today)
+            path.write_text(text, encoding="utf-8")
+        else:
+            check_release(text, args.version, today)
</code_context>
<issue_to_address>
**Interrupted writes damage citation file**

When the process is interrupted or a write error occurs after the destination has been opened and truncated, `Path.write_text` opens the destination for writing and truncates it before writing the replacement. If the process is interrupted or a write raises after truncation, `main` returns an error but leaves an empty or partial `CITATION.cff`, so subsequent validation and release checks fail and the working copy loses its previous metadata.

Write to a temporary file in the same directory and atomically replace the destination only after the full write succeeds.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if the author list or release version/date is wrong, Zenodo can archive that citation metadata with a release, and reverting this change would not remove an existing archive. The affected metadata is bounded and can be corrected in the archive.

Blocking findings: scripts/citation.py:218


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/citation.py Resolved
uniqueg and others added 2 commits October 23, 2026 00:53
Sourcery review: set writes a temporary file and replaces CITATION.cff
only once it is complete, so a failed write never leaves it truncated.
The default-date test now pins the clock at a time whose UTC date
differs from the local one, so a local-clock regression fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 7344801 into dev Oct 22, 2026
13 checks passed
@uniqueg
uniqueg deleted the docs/citation branch October 22, 2026 23:04
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.

1 participant