Registry / serialization / std-uritemplate

std-uritemplate

JSON →
library2.0.12pypypi✓ verified 25d ago

std-uritemplate is a Python library providing a robust and compliant implementation of RFC 6570, the URI Template specification. It allows users to expand URI templates with provided variables, generating complete URIs. The library is actively maintained, with frequent patch releases within major versions, and is currently at version 2.0.8.

pip install std-uritemplate
INSTALL
IMPORT
SIG · STD-URITEMPLATE
S
std-uritemplate
serializationpythonv2.0.12
Install
1.8s avg
Import
18ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.12 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.018s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.018s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

StdUriTemplate
from stduritemplate import StdUriTemplate
from uritemplate import URITemplate

Initialize a URITemplate object with your template string. Use the `expand` method to fill in variables and generate the final URI. `partial_expand` can be used to expand a subset of variables, returning a new `URITemplate` object with the remaining unexpanded variables.

from uritemplate import URITemplate template_str = "https://example.com/api/{resource}{?id,name}" tpl = URITemplate(template_str) # Expand with simple variables expanded_uri = tpl.expand(resource="users", id=123, name="Alice") print(f"Expanded URI: {expanded_uri}") # Partial expansion partially_expanded_tpl = tpl.partial_expand(resource="posts") print(f"Partially Expanded URI (with resource): {partially_expanded_tpl.template}") # Final expansion of partially expanded template final_uri = partially_expanded_tpl.expand(id=456) print(f"Final URI: {final_uri}")
Debug
Known issues
breakingVersion 2.0.0 introduced a significant API change. The `URITemplate` class is now the primary entry point for working with URI templates, replacing the direct `uritemplate.expand` and `uritemplate.partial_expand` functions.
fix
Migrate existing code to use `URITemplate(template_str).expand(**variables)` instead of `uritemplate.expand(template_str, **variables)`.
affects: >=2.0.0
deprecatedThe standalone functions `uritemplate.expand()` and `uritemplate.partial_expand()` have been deprecated in favor of the methods on the `URITemplate` class.
fix
Instantiate `URITemplate` and call its `expand()` or `partial_expand()` methods. Example: `URITemplate(template).expand(var=value)`.
affects: >=2.0.0
gotchaThe library strictly adheres to RFC 6570. Misunderstandings of the RFC's nuances regarding variable modifiers (e.g., `+`, `#`, `.`, `/`, `;`, `?`, `&`) or how different variable types (simple, lists, dictionaries) are expanded can lead to unexpected URI outputs.
fix
Consult RFC 6570 for specific behavior of operators and variable types, and test template expansions thoroughly, especially with complex data structures.
affects: all
gotchaThe package name for installation is `std-uritemplate`, but the Python module to import is `uritemplate`. This is a common source of `ModuleNotFoundError`.
fix
Ensure you use `import uritemplate` or `from uritemplate import ...` after `pip install std-uritemplate`.
affects: all
Upgrade
Version history
2.0.12latest on PyPI · released Jul 16, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources
std-uritemplate — pip install std-uritemplate · libregistry