Registry / serialization / curies

curies

JSON →
library0.13.13pypypi✓ verified 86d ago

The `curies` Python package provides efficient, faultless, and idiomatic utilities for converting between Uniform Resource Identifiers (URIs) and Compact URIs (CURIEs). It is a crucial low-level tool for linked data applications, enabling data scientists, curators, and software developers to handle prefix maps, expand CURIEs to URIs, and compress URIs to CURIEs. The library is actively developed, currently at version 0.13.3, with ongoing enhancements for robustness and usability.

pip install curies
INSTALL
IMPORT
SIG · CURIES
C
curies
serializationpythonv0.13.13
Install
3.5s avg
Import
687ms
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.13.13 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.725s · 31.5MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.5s · import 0.649s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

curies
import curies
Standard import for accessing all top-level functions and classes.
Converter
from curies import Converter
For direct instantiation of the Converter class, though often created via helper functions.

This quickstart demonstrates how to load a predefined CURIE converter and then use it to expand CURIEs to URIs and compress URIs back to CURIEs. Alternatively, you can define and load your own prefix map.

import curies # Option 1: Load a predefined converter (e.g., OBO Foundry) converter = curies.get_obo_converter() # Option 2: Load a custom prefix map # prefix_map = {"CHEBI": "http://purl.obolibrary.org/obo/CHEBI_"} # converter = curies.load_prefix_map(prefix_map) # Expand a CURIE to a URI curie_example = "CHEBI:1" expanded_uri = converter.expand(curie_example) print(f"Expanded '{curie_example}' to '{expanded_uri}'") # Expected: Expanded 'CHEBI:1' to 'http://purl.obolibrary.org/obo/CHEBI_1' # Compress a URI to a CURIE uri_example = "http://purl.obolibrary.org/obo/CHEBI_2" compressed_curie = converter.compress(uri_example) print(f"Compressed '{uri_example}' to '{compressed_curie}'") # Expected: Compressed 'http://purl.obolibrary.org/obo/CHEBI_2' to 'CHEBI:2'
Debug
Known issues
breakingAs a library in the 0.x.x version range, `curies` is not yet considered stable. Breaking changes to the API may occur between minor versions (e.g., from 0.12 to 0.13).
fix
Always review the release notes and changelog when upgrading `curies` to a new minor version to identify any necessary code adjustments.
affects: <1.0.0
gotchaWhen loading prefix maps, especially with overlapping URI prefixes (e.g., 'http://purl.obolibrary.org/obo/' and 'http://purl.obolibrary.org/obo/CHEBI_'), `curies` prioritizes the first matching prefix encountered. This behavior ensures 'faultless' conversion but may differ from expectations if not explicitly considered.
fix
Ensure that your custom prefix maps are ordered from most specific to least specific, or be aware that the first definition for a prefix/URI prefix pair will take precedence in resolution.
affects: All
Errors
Common errors & fixes
NameError: name 'curies' is not defined
The `curies` module was used without being imported first.
fix
Add `import curies` at the top of your Python script or interactive session before using any functions or classes from the library.
AttributeError: 'NoneType' object has no attribute 'compress'
A converter object (e.g., returned by `curies.load_prefix_map()` or `curies.get_obo_converter()`) was `None`, indicating that it failed to initialize properly, and subsequently, a method like `compress()` was called on this `None` object.
fix
Verify that your prefix map input is valid, or that the predefined converter could be loaded successfully. Always check that the `converter` object is not `None` before attempting to use its methods.
Upgrade
Version history
0.13.13latest on PyPI · released Jun 12, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or higher.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
curies — pip install curies · libregistry