commonmeta-py is a Python library to implement Commonmeta, the common Metadata Model for Scholarly Metadata. Use commonmeta-py to convert scholarly metadata, in a variety of formats, listed below. The first release on PyPi (version 0.5.0) was on February 16, 2023. Up until version 0.5.1, the library was called talbot. Commonmeta is also available as a Rust library commonmeta-rs.
commonmeta-py uses semantic versioning. Currently, its major version number is still at 0, meaning the API is not yet stable, and breaking changes are expected in the internal API and commonmeta JSON format.
Add commonmeta-py as a library dependency to your project:
uv add commonmeta-py
To use the commonmeta command-line tool, install it globally with
uv instead:
uv tool install commonmeta-py
This makes commonmeta available on your PATH. Upgrade it later with
uv tool upgrade commonmeta-py, or remove it with uv tool uninstall commonmeta-py.
Writing a pdf rendition of a post (the write_pdf option of the InvenioRDM
writer) goes through WeasyPrint, which needs pango at the system level:
brew install pango on macOS, apt install libpango-1.0-0 libpangoft2-1.0-0
on Debian and Ubuntu. Everything else works without it. On macOS, dyld looks
for those libraries in DYLD_FALLBACK_LIBRARY_PATH, so a homebrew install
needs export DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix)/lib.
The renditions are PDF/A-3a: archival, tagged, so a screen reader reads their
structure rather than placed glyphs, and carrying the post's html as an
embedded file. That variant needs WeasyPrint 69, which requires Python 3.10;
on Python 3.9 WeasyPrint is not installed at all and the writer reports that
it cannot render a pdf. Reading a rendition back — read_pdf_metadata and
read_pdf_attachment in commonmeta.io_utils — goes through pikepdf and
works on every supported Python.
Commometa-py reads and/or writes these metadata formats:
| Format | Name | Content Type | Read | Write |
|---|---|---|---|---|
| Commonmeta | commonmeta | application/vnd.commonmeta+json | yes | yes |
| CrossRef XML | crossref_xml | application/vnd.crossref.unixref+xml | yes | yes |
| Crossref | crossref | application/vnd.crossref+json | yes | yes |
| DataCite | datacite | application/vnd.datacite.datacite+json | yes | yes |
| Schema.org (in JSON-LD) | schema_org | application/vnd.schemaorg.ld+json | yes | yes |
| RDF XML | rdf_xml | application/rdf+xml | no | later |
| RDF Turtle | turtle | text/turtle | no | later |
| CSL-JSON | csl | application/vnd.citationstyles.csl+json | yes | yes |
| Formatted text citation | citation | text/x-bibliography | n/a | yes |
| Codemeta | codemeta | application/vnd.codemeta.ld+json | yes | later |
| Citation File Format (CFF) | cff | application/vnd.cff+yaml | yes | later |
| JATS | jats | application/vnd.jats+xml | later | later |
| CSV | csv | text/csv | no | later |
| BibTex | bibtex | application/x-bibtex | yes | yes |
| RIS | ris | application/x-research-info-systems | yes | yes |
| InvenioRDM | inveniordm | application/vnd.inveniordm.v1+json | yes | yes |
| OpenAlex | openalex | yes | no |
commonmeta: the Commonmeta format is the native format for the library and used internally. Planned: we plan to implement this format for the v1.0 public release. Later: we plan to implement this format in a later release.
Installing commonmeta-py provides a commonmeta command with the subcommands
convert, list, put, push, encode, and decode.
You can also run the CLI without installing anything, using
uv. Because the package name (commonmeta-py)
differs from the command name (commonmeta), pass it with --from:
uvx --from commonmeta-py commonmeta convert 10.5555/12345678 --to cslThe examples below use commonmeta ...; prefix them with
uvx --from commonmeta-py to run the same commands without installing.
# Encode/decode a Crockford base32 identifier suffix given a DOI prefix
commonmeta encode 10.5555
commonmeta decode 10.5555/nwbyp-29t86
# Convert a single record between formats, fetching it by DOI
# (--from is auto-detected from a DOI/URL, so it can usually be omitted)
commonmeta convert 10.5555/12345678 --to csl
# Convert a local file and write the result to disk
commonmeta convert record.json --from commonmeta --to csl --file out.json
# Render a formatted citation (CSL style + locale)
commonmeta convert 10.5555/12345678 --to citation --style apa --locale en-US
# Convert to Crossref XML, DataCite JSON, schema.org, BibTeX, or RIS
commonmeta convert 10.5555/12345678 --to crossref_xml
commonmeta convert 10.5555/12345678 --to datacite
# Convert a list of records from a local JSON/JSONL file
commonmeta list records.json --to bibtex --file out.bib
# Read a VRAIX daily dump and convert it (the --from value is the source)
commonmeta list --from crossref --date 2026-06-15 --to commonmeta --file out.json
# Fetch a batch of random records from an API (crossref, datacite, or openalex)
commonmeta list --sample --from crossref --number 5
# Register records with a live InvenioRDM instance (creates/updates and publishes
# real records — registration is currently only supported with --to inveniordm)
commonmeta push records.json --to inveniordm --host rogue-scholar.org --token TOKEN
# Same as push, but for a single record (DOI, URL, or file path)
commonmeta put 10.5555/12345678 --from crossref --to inveniordm --host rogue-scholar.org --token TOKEN
# Work fully offline — fails fast if a network call would be required
commonmeta convert record.json --from commonmeta --to csl --no-networkUse commonmeta <subcommand> --help for the full list of options. --from/-f
sets the input format (auto-detected when omitted) and --to/-t the output
format. JSON output (commonmeta, datacite, schema_org, crossref,
inveniordm, csl) is pretty-printed; use --file to write to disk instead of
stdout.
convert and list accept --no-network: any step that would make an outbound
request (fetching a DOI/URL, --sample, or downloading a VRAIX dump) fails
immediately with a clear message, while operations on local files always
succeed. push and put always require network access.
Documentation (work in progress) for using the library is available at the commonmeta-py Documentation website.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
License: MIT