Skip to content

Add CITATION.cff file #1597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 25, 2025
Merged

Add CITATION.cff file #1597

merged 13 commits into from
Mar 25, 2025

Conversation

mhucka
Copy link
Contributor

@mhucka mhucka commented Mar 15, 2025

A file in CITATION File Format (CITATION.cff) can be placed at the top level of a GitHub repo to provide machine-readable citation information that helps users correctly cite software. When it detects a CITATION.cff file in a repository, GitHub adds a button to the upper right sidebar that lets users copy a formatted citation.

I generated this particular CITATION.cff file mostly by hand, with a little initial help from Citation.js.

This commit also includes a GitHub Actions workflow to update the release version & date in the CITATION.cff file automatically when a new software release is made on GitHub. This solves the problem of keeping the version & date in the file in sync with releases. Removed the workflow, after discussions during review revealed a problem that still needs resolving.

@mpharrigan and @tanujkhattar: the abstract and the list of keywords in the CITATION.cff file could use a review. I gave it a good try but there may still be errors.

@mhucka mhucka marked this pull request as ready for review March 15, 2025 03:30
@mhucka mhucka enabled auto-merge (squash) March 15, 2025 03:30
@mhucka mhucka disabled auto-merge March 15, 2025 03:31
mhucka added 8 commits March 15, 2025 11:40
This adds explanatory comments, and very slightly edits formatting and
the keyword list.
Man, sometimes the CITATION.cff limitations are so annoying. This time
it's because "volume" has to be a plain integer.
This GitHub Actions workflow will update the version and date fields
in the CITATION.cff file when a new release is done in GitHub.

- if: steps.update.outputs.success == 'true'
name: Commit the updated CITATION.cff back to the repo
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this commit directly to main? or open a PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It commits directly to main. This way, as soon as the release is done, the citation.cff file gets updated, and shortly thereafter GitHub will pick up the changes and update the "Cite this repository" contents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does this commit directly to main? or open a PR?

(Should I add comments in the file to make that more clear?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, maybe others will have the same question as me.

This does set up a weird circular problem where the tagged commit will never contain the citation.cff file that references it, but I don't think there's any way around that

Copy link
Contributor Author

@mhucka mhucka Mar 21, 2025

Choose a reason for hiding this comment

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

This does set up a weird circular problem where the tagged commit will never contain the citation.cff file that references it, but I don't think there's any way around that

@mpharrigan (Face palm.) I … didn't think of that. I was too focused on updating the info on GitHub and forgot about the implications for doing it as a response to a release, rather than a precursor to a release.

What if, instead of triggering on a release event, it triggered when a tag was created? Based on how-to-cut-a-release.md, it looks like triggering on a tagging event would do it, as that precedes the step to package the release. Do you guys tag for any except releases? (If so, we could filter based on an appropriate tag pattern, to skip non-release tagging events.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the time being, I'm going to remove the workflow, and just add the .cff and the readme addition. The auto-updater is not essential and can be sorted out later.

@mpharrigan
Copy link
Collaborator

will the citation button generate the same bibtex as that included in (added to) the readme?

@mhucka
Copy link
Contributor Author

mhucka commented Mar 19, 2025

will the citation button generate the same bibtex as that included in (added to) the readme?

Good question. The BibTeX in the readme file came from arXiv itself, except for the doi field, which I added manually because it's not uncommon in BibTeX styles. (I don't know why arXiv doesn't provide it.)

First, I see that the type of the preferred-citation should be "misc" and not "article". After fixing that, I tested GitHub's conversion of CITATION.cff to BibTeX by adding the CITATION.cff file to my fork, then using GitHub's button. Here's the output:

@misc{Harrigan_Expressing_and_Analyzing_2024,
  author = {Harrigan, Matthew P. and Khattar, Tanuj and Yuan, Charles and Peduri, Anurudh and Yosri, Noureldin and Malone, Fionn D. and Babbush, Ryan and Rubin, Nicholas C.},
  doi = {10.48550/arXiv.2409.04643},
  title = {{Expressing and Analyzing Quantum Algorithms with Qualtran}},
  url = {https://arxiv.org/abs/2409.04643},
  year = {2024}
}

You can see it drops the fields eprint, archivePrefix and primaryClass, but otherwise is the same (well, authors names are put in an alternate but equivalent form). Now, the thing is, archivePrefix and primaryClass are not (as far as I can tell) used by any BibTeX class; the only field that gets any use is eprint, and even that is not universal. ArXiv's documentation lists some BST files and extensions to support eprint.

The more I look at this, the more I think we should remove the archivePrefix and primaryClass from the BibTeX on the front. It doesn't add anything and may instead just add trouble.

So that leaves the missing eprint field. CITATION.cff doesn't define such a field for the citations, but it does have a way to add additional identifiers and keywords. It's a bit of a long shot, but I tried using that to define it this way:

  ...
  identifiers:
    - description: arXiv identifier for the submission
      value: 2409.04643
      type: other
  keywords:
    - quant-ph

Unfortunately, GitHub does not seem to produce any different output.

How significant would be the lost of the eprint field?

@mhucka mhucka force-pushed the mh-add-citation-cff branch from 0f0f8de to dbd8828 Compare March 19, 2025 02:35
They're nonstandard and don't seem to be used much.
@mpharrigan
Copy link
Collaborator

Thanks for checking. If we can't get the eprint field, then so be it

@mhucka mhucka merged commit 1ed1444 into quantumlib:main Mar 25, 2025
8 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.

2 participants