urn_citation
A Python library for working with CITE architecture URNs for scholarly citation.
Overview
urn_citation provides Pydantic-based models for representing and parsing Uniform Resource Names (URNs) defined for the CITE architecture. The current release supports Canonical Text Service (CTS) URNs, which are used to identify passages of canonically citable texts with hierarchical work and passage components.
Features
- Pydantic Models: Type-safe URN representations with validation
- CTS URN Support: Full support for parsing and creating Canonical Text Service URNs
- Flexible Parsing: Parse CTS URN strings into structured objects
- Optional Fields: Support for optional work, version, exemplar, and passage components
Installation
pip install urn-citation
Quick Start
Creating a CTS URN
from urn_citation import CtsUrn
# Create a CTS URN with required fields
urn = CtsUrn(
urn_type="cts",
namespace="greekLit",
text_group="tlg0012"
)
# Create a CTS URN with all fields
urn_full = CtsUrn(
urn_type="cts",
namespace="greekLit",
text_group="tlg0012",
work="001",
version="wacl1",
exemplar="ex1",
passage="1.1-1.5"
)
Parsing from a String
# Parse a CTS URN from a colon-delimited string
urn_string = "urn:cts:greekLit:tlg0012.001.wacl1:1.1-1.5"
urn = CtsUrn.from_string(urn_string)
print(urn.text_group) # "tlg0012"
print(urn.work) # "001"
print(urn.version) # "wacl1"
print(urn.passage) # "1.1-1.5"
Serialization
# Convert to dictionary
urn_dict = urn.model_dump()
# Convert to JSON
urn_json = urn.model_dump_json()
CTS URN Structure
A CTS URN follows the format:
urn:cts:<namespace>:<work_component>:<passage_component>
Where:
- namespace: The namespace defining the text collection (e.g., "greekLit", "latinLit")
- work_component: One to four dot-delimited identifiers for text group, work, version, and exemplar
- passage_component: Optional passage reference, may contain a single passage or range (with hyphen)
License
See the LICENSE file for details.
Documentation
See API documentation for more details on the classes and methods provided by this library.
Release files for urn-citation 0.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| urn_citation-0.7.3.tar.gz | 65.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| urn_citation-0.7.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.2 kB
Release files / urn_citation-0.7.3.tar.gz
| Download URL | urn_citation-0.7.3.tar.gz |
|---|---|
| Size | 65.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b4524ee82f8fff14f903a528ceed39bcaf2429f13e80ffd72a20411e9157737
|
|
BLAKE2b-256 checksum How to use checksums |
9d9362e2dddffd01b99155ef3eb53123c724d53191e98d615e004b2e275d310d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.
Transparency logRelease files / urn_citation-0.7.3-py3-none-any.whl
| Download URL | urn_citation-0.7.3-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ea93a596569e9888064992f44dc5c84af8bd0dbf8bc6604f8d34f9b196c960c
|
|
BLAKE2b-256 checksum How to use checksums |
40603121ea0909cc8adcc4e5c2d181871423dbf957df3ff877497e7feb5cfcd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.
Transparency log