This release is a pre-release and may not be stable for production use.
uri
Python implementation of uri, 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. Open issues and pull requests in
hop-top/uri-poly.
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.
- Validate behavior against shared polyglot contract fixtures.
Usage
Agent instructions:
Install this Python package as `hop-top-uri` from PyPI when published, or use
the local py/ package while working inside uri-poly. Import from uri.
For usage docs and contract details, read
https://github.com/hop-top/uri-poly/tree/main/docs and
https://github.com/hop-top/uri-poly/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 uri import parse
parsed = parse("task://hop-top/uri/T-0001")
print(parsed.namespace) # hop-top/uri
print(parsed.id) # T-0001
Action routing:
from uri 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 uri 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/uri/T-0001",
prefix=True,
preserve_suffix=True,
)
],
),
)
print(parsed.canonical()) # task://hop-top/uri/T-0001/child
API docs: docs/specs
and spec/fixtures.
License
MIT. See the hop-top/uri-poly LICENSE.
Metadata
Release files for hop-top-uri 0.2.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hop_top_uri-0.2.0a2.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hop_top_uri-0.2.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.6 kB
Release files / hop_top_uri-0.2.0a2.tar.gz
| Download URL | hop_top_uri-0.2.0a2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fce5b0392f65b3b1bb54e423a5c2da707f55ffb3d2eb3f936ccd5eaae0e740ba
|
|
BLAKE2b-256 checksum How to use checksums |
107b51a388fc15d31df105d620bbc39c11f5d5e140ef7a2cba1a4429ca31c9fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / hop_top_uri-0.2.0a2-py3-none-any.whl
| Download URL | hop_top_uri-0.2.0a2-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2c06f692d57a8f4db33ab6455913c264632cf04f51e80d95e0c74f3d81aa669
|
|
BLAKE2b-256 checksum How to use checksums |
589ec5ccf28ce32fdce7ffdf4a17168fe560d4f2da67f0d2c41cdf9c8fcc151d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|