cite (py)
Python implementation of cite, the polyglot custom URI parsing and
handler-generation contract for app frameworks, CLIs, and agent-assisted tools.
This repository is a read-only language mirror, republished from the
hop-top/poly-citemonorepo on each release. Open issues and pull requests inhop-top/poly-cite.
Features
- Parse canonical custom URIs into scheme, namespace, id, query, fragment, original, and action fields.
- Apply configurable namespace policies per scheme.
- Resolve vanity aliases, fuzzy vanity matches, and completion candidates.
- Normalize action queries such as
action=task.claim,cmd=task&verb=claim, andname=task&action=claim. - Resolve action routes to command plans without executing them.
- Register URI types with parsers and completers.
- Generate language-scoped handler artifacts for Linux, macOS/iOS, and Windows. (guide)
- Validate behavior against shared polyglot contract fixtures.
Usage
Agent instructions:
Install this Python package as `hop-top-cite` from PyPI when published, or use
the local py/ package while working inside poly-cite. Import from cite.
For usage docs and contract details, read
https://github.com/hop-top/poly-cite/tree/main/docs and
https://github.com/hop-top/poly-cite/tree/main/spec.
App Authors
Use this package when your app needs stable custom URI identity, vanity links, completion candidates, or handler artifacts.
Basic parsing:
from cite import parse
parsed = parse("task://hop-top/cite/T-0001")
print(parsed.namespace) # hop-top/cite
print(parsed.id) # T-0001
Action routing:
from cite import ActionRoute, Policy, parse, resolve_action
policy = Policy(
default_namespace_segments=1,
scheme_namespace_segments={"tlc": 2},
action_routes={
"task.claim": ActionRoute(
command="tlc",
args=["-C", "{namespace}", "task", "claim", "{id}"],
)
},
)
parsed = parse("tlc://org/repo/T-0001?name=task&action=claim", policy)
plan = resolve_action(parsed, policy)
print(plan.args) # ["-C", "org/repo", "task", "claim", "T-0001"]
Advanced vanity alias:
from cite import Policy, VanityAlias, parse
parsed = parse(
"task://shortcut/child",
Policy(
default_namespace_segments=1,
scheme_namespace_segments={"task": 2},
vanity_aliases=[
VanityAlias(
from_="task://shortcut",
to="task://hop-top/cite/T-0001",
prefix=True,
preserve_suffix=True,
)
],
),
)
print(parsed.canonical()) # task://hop-top/cite/T-0001/child
API docs: docs/specs
and spec/fixtures.
License
MIT. See the hop-top/poly-cite LICENSE.
Metadata
Release files for hop-top-cite 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hop_top_cite-0.1.1.tar.gz | 10.9 kB | Without provenance | Details for hop_top_cite-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hop_top_cite-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for hop_top_cite-0.1.1-py3-none-any.whl |
Total release size: 19.7 kB
Release files / hop_top_cite-0.1.1.tar.gz
| Download URL | hop_top_cite-0.1.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e28e37adb6ba35a4db8c024d7dfacba144c59a3c4bfe3da91dc9bb50d9f96b8
|
|
BLAKE2b-256 checksum How to use checksums |
b7021fc3b7af741b0335825e1f74447a5876c27e396a993a3926e2946c93ce54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / hop_top_cite-0.1.1-py3-none-any.whl
| Download URL | hop_top_cite-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f6df1699501221e02d0e300e2361b63851a83072459ca67f695f044719b86a8
|
|
BLAKE2b-256 checksum How to use checksums |
b10f338460c1054482a9272eceac19573061f848516f3bf8408dc6d0f14d39f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for hop-top-cite 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.