Skip to content

feat: add Crossref DOI provider#2249

Merged
utnapischtim merged 6 commits into
inveniosoftware:masterfrom
front-matter:crossref_doi_provider
Jun 5, 2026
Merged

feat: add Crossref DOI provider#2249
utnapischtim merged 6 commits into
inveniosoftware:masterfrom
front-matter:crossref_doi_provider

Conversation

@mfenner

@mfenner mfenner commented Feb 3, 2026

Copy link
Copy Markdown
Contributor
  • register DOIs with Crossref, functionality analogous to DataCitePIDProvider
  • CrossrefXMLSerializer with metadata export

❤️ Thank you for your contribution!

Description

This pull-request adds Crossref DOI registration support to InvenioRDM. The configuration is very similar to DataCite DOI registration, and the new PID provider should not interfere with DataCite DOI registration.

The Crossref PID provider makes heavy use of the commonmeta-py library, similar to how the datacite library is used in the DataCite PID provider. commonmeta-py already was a dependency, but a newer version (>= 0.183) is required for Crossref DOI registration functionality.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@mfenner

mfenner commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

Opened this PR instead of #2177 as the PR was open for too long.

@tmorrell tmorrell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a nice well-tested addition. I have one question about the vocabulary changes that should be addressed, but otherwise looks good to go

Comment thread invenio_rdm_records/fixtures/tasks.py Outdated
Comment thread invenio_rdm_records/config.py Outdated
@mfenner

mfenner commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for the extra commits, I accidentally named one test file with a capital T, and MacOS doesn't care. And there are issues with tests that I need to again look into.

@mfenner mfenner force-pushed the crossref_doi_provider branch 2 times, most recently from 33607ea to 9816716 Compare February 4, 2026 17:24
@mfenner

mfenner commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

I have fixed most tests and added one new feature. I will do more cleanup via rebasing.

Aware that the Invenio partner meeting is less than three weeks away and that this is the best chance to get this PR discussed and approved, I added the following functionality:

  • Allow Crossref and DataCite DOI registration in the same instance
  • Allow multiple DOI prefixed per provider in addition to the default prefix both for Crossref and DataCite
  • Control the DOI Provider and DOI prefix in the REST API call when creating the record

All of the above is optional, the DataCite defaults have not changed, and Crossref is (almost) a drop in replacement, i.e. all DOIs are registered via Crossref and with one prefix. I say almost, as there are some subtle differences.

I left out the decision flow and UI part of how a DOI provider and prefix are picked if there are multiple. This is tricky and needs more discussion. There is strong interest in one prefix per community, but records can be registered before a community is added and moved to a different community. The other major decision point is content type, as Crossref only supports text content types. But the UI of changing the content type of a record then becomes more complicated. A good discussion topic at the workshop.

This PR can be merged before or at the workshop. It provides a good foundation for more flexibility in DOI registration in v14. Instances can build on that addressing their use cases, or we might have a good discussion at the workshop about a first UI implementation. I will deploy the branch (or the merged master) in my production instance this week, so that I can test DOI registration for a few hundred DOIs (my usual quota) until the workshop.

@mfenner mfenner force-pushed the crossref_doi_provider branch 17 times, most recently from d897466 to 7b04995 Compare February 9, 2026 22:59
@mfenner

mfenner commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

I fixed all tests - the Python 3.9 tests fail because the commonmeta-py dependency requires 3.10 in recent versions. Also seing no issues in my production instance so far, with a few hundred records registered with Crossref with this latest version.

Comment thread invenio_rdm_records/config.py
@utnapischtim utnapischtim added this to v14 Feb 17, 2026
@tmorrell tmorrell moved this to 👀 In review in v14 Feb 24, 2026
@mfenner mfenner force-pushed the crossref_doi_provider branch 4 times, most recently from f1f4999 to 3906233 Compare March 2, 2026 15:28
@utnapischtim utnapischtim moved this from 👀 In review to Needed in v14 Mar 24, 2026
@utnapischtim

Copy link
Copy Markdown
Contributor

@mfenner could it be that you missed to add the CROSSREF_ prefix to be loaded in ext.py like datacite here

@mfenner

mfenner commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@utnapischtim what would this enable? I am registering DOIs with Crossref in my instance without issues.

@utnapischtim

Copy link
Copy Markdown
Contributor

@mfenner
yes, and i think you will configure the crossref configuration variables in your invenio.cfg file (or somewhere else) but if you set up a new instance and you don't configure CROSSREF_* in your invenio.cfg file, no crossref configuration variables would be loaded. so this would fail with

invenio_rdm_records/services/pids/providers/external.py", line 32, in prefixes
    val = current_app.config[name]
          ~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'CROSSREF_PREFIX'

Loading the values as i suggested would fix the problem.

@mfenner

mfenner commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@utnapischtim added CROSSREF_ prefix as you suggested.

@mfenner mfenner force-pushed the crossref_doi_provider branch 3 times, most recently from ede650e to 7c0a38a Compare June 1, 2026 18:31
@mfenner

mfenner commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@utnapischtim I merged the latest code from master, included a new commonmeta-py version (0.215) which uses a simpler approach to crossref_xml generation and supports Python 3.9, and fixed the failing crossref serializer test. Tried to rebase, but still not comfortable doing this, especially in such an important package. All tests. pass now and I will continue to use the branch in my production instance.

@utnapischtim utnapischtim force-pushed the crossref_doi_provider branch from 7c0a38a to 424a46c Compare June 5, 2026 12:16
mfenner and others added 6 commits June 5, 2026 14:18
* address breaking changes (caused by adding type hints) in commonmeta-py 0.182
* optionally pass in prefix via kwargs from list of allowed prefixes
* adjust blocked prefixes for external DOI provider
* register DOIs with Crossref, functionality analogous to DataCitePIDProvider
* CrossrefXMLSerializer for metadata export
* includes test coverage similar to DataCite PID provider
* Make parent PID registration not break with multiple PID providers and/or prefixes
* Copy provider from child to parent
* Extract prefix from the child's identifier
* added CROSSREF_ prefix
@utnapischtim utnapischtim force-pushed the crossref_doi_provider branch from 424a46c to 95e9987 Compare June 5, 2026 12:18
@utnapischtim utnapischtim merged commit 1ad8906 into inveniosoftware:master Jun 5, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Needed to To release 🤖 in v14 Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To release 🤖

Development

Successfully merging this pull request may close these issues.

5 participants