Registry / http-networking / uritemplate

uritemplate

JSON →
library4.2.0pypypi✓ verified 30d ago

A Python library for implementing RFC 6570 URI Templates, currently at version 4.2.0, with a release cadence of approximately every 1-2 years.

pip install uritemplate
INSTALL
IMPORT
SIG · URITEMPLATE
U
uritemplate
http-networkingpythonv4.2.0
Install
1.6s avg
Import
26ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.2.0 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.028s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.024s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

expand
✓ from uritemplate import expand
Direct import of 'expand' function from 'uritemplate' module.
URITemplate
✓ from uritemplate import URITemplate
Direct import of 'URITemplate' class from 'uritemplate' module.

Expands a URI template with a user variable using the 'expand' function from 'uritemplate'.

from uritemplate import expand uri = 'https://api.github.com{/user}' expanded_uri = expand(uri, user='sigmavirus24') print(expanded_uri)
Debug
Known issues
breakingDirect import of 'expand' and 'URITemplate' from 'uritemplate' module is required; previous import paths may be deprecated.
fix
Update import statements to 'from uritemplate import expand' and 'from uritemplate import URITemplate'.
affects: 4.2.0
gotchaPassing values by both 'var_dict' and 'kwargs' in 'expand' function may override values in 'var_dict'.
fix
Ensure consistency between 'var_dict' and 'kwargs' to avoid unintentional overrides.
affects: 4.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'uritemplate'
The 'uritemplate' library is not installed in the current Python environment.
fix
pip install uritemplate
TypeError: expand() missing 1 required positional argument: 'var_dict'
The `expand` method of a URITemplate object was called without the required dictionary of variables or with a non-dictionary positional argument.
fix
template.expand({'variable': 'value'})
TypeError: argument of type 'NoneType' is not iterable
The `expand` method was called with `None` as the argument for variables, which is not an iterable type like a dictionary.
fix
template.expand({'variable': 'value'})
Missing '}' in URI template segment '{foo'
The URI template string contains a syntax error, such as a missing closing brace or an invalid expression, violating RFC 6570.
fix
template = uritemplate.URITemplate('/path/{foo}')
Upgrade
Version history
4.2.0latest on PyPI · released Jun 2, 2025
Audit
Dependencies
requestsoptionalOptional, for making HTTP requests with expanded URIs
Agent activity
25 hits · last 30 days
node
22
Anthropic
1
OpenAI (training)
1
Resources
uritemplate — pip install uritemplate · libregistry