A Python library for working with CITE architecture URNs for scholarly citation.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file urn_citation-0.2.0.tar.gz.
File metadata
- Download URL: urn_citation-0.2.0.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43b990855f3952f77fba4d934620e625d96107dfccabf8915f01d3b982b442ac
|
|
| MD5 |
93a9f10708133ffa42d06c39c73917fd
|
|
| BLAKE2b-256 |
51f2e654eefc7a47a7d0ad524741a1631bafebd99c80d58de7474221a542be5a
|
Provenance
The following attestation bundles were made for urn_citation-0.2.0.tar.gz:
Publisher:
publish.yml on neelsmith/urn_citation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urn_citation-0.2.0.tar.gz -
Subject digest:
43b990855f3952f77fba4d934620e625d96107dfccabf8915f01d3b982b442ac - Sigstore transparency entry: 826096607
- Sigstore integration time:
-
Permalink:
neelsmith/urn_citation@94fc45d3bb53e8cd761362f8a044309f41b5f9c3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/neelsmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94fc45d3bb53e8cd761362f8a044309f41b5f9c3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file urn_citation-0.2.0-py3-none-any.whl.
File metadata
- Download URL: urn_citation-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
169dde232afced2ea7a7596008b9c65dafe49e66b92ea83d0abbedbb1abbbb91
|
|
| MD5 |
b555a2bf7df884ed80510f3ff3e85d29
|
|
| BLAKE2b-256 |
68d8dc01cc5bd8fcbe89813c8f2b76ec38e01fea6248f8b96a8b1901fbcc3e31
|
Provenance
The following attestation bundles were made for urn_citation-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on neelsmith/urn_citation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urn_citation-0.2.0-py3-none-any.whl -
Subject digest:
169dde232afced2ea7a7596008b9c65dafe49e66b92ea83d0abbedbb1abbbb91 - Sigstore transparency entry: 826096646
- Sigstore integration time:
-
Permalink:
neelsmith/urn_citation@94fc45d3bb53e8cd761362f8a044309f41b5f9c3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/neelsmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94fc45d3bb53e8cd761362f8a044309f41b5f9c3 -
Trigger Event:
release
-
Statement type: