skillfed

uritemplate

Implementation of RFC 6570 URI Templates

uritemplate Permissive license BSD 3-Clause OR Apache-2.0 Active 246 v4.2.0 released

Install

uritemplate on PyPI

pip

pip install uritemplate

uv

uv add uritemplate

poetry

poetry add uritemplate

Package facts

License BSD 3-Clause OR Apache-2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 437 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: uritemplate-4.2.0-py3-none-any.whl

Keywords: rfc, 6570, uri, template

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPython

About uritemplate

from the package's own PyPI description — quoted content, verbatim

uritemplate

Documentation_ -- GitHub_ -- Travis-CI_

Simple python library to deal with URI Templates_. The API looks like

.. code-block:: python

from uritemplate import URITemplate, expand

# NOTE: URI params must be strings not integers

gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
t = URITemplate(gist_uri)
print(t.expand(gist_id='123456'))
# => https://api.github.com/users/sigmavirus24/gists/123456

# or
print(expand(gist_uri, gist_id='123456'))

# also
t.expand({'gist_id': '123456'})
print(expand(gist_uri, {'gist_id': '123456'}))

Where it might be useful to have a class

.. code-block:: python

import requests

class GitHubUser(object):
    url = URITemplate('https://api.github.com/user{/login}')
    def __init__(self, name):
        self.api_url = url.expand(login=name)
        response = requests.get(self.api_url)
        if response.status_code == 200:
            self.__dict__.update(response.json())

When the module containing this class is loaded, GitHubUser.url is evaluated and so the template is created once. It's often hard to notice...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Expands RFC 6570 URI templates by substituting variables into template expressions, useful for constructing dynamic URLs in API clients and web applications.

Minimal friction: pure Python wheel with zero runtime dependencies and active maintenance (last commit 2026-08-10, 437 days since latest release). Requires Python 3.9+.

Dual-licensed under BSD 3-Clause or Apache-2.0 (permissive); either license permits commercial and private use with minimal restrictions, making it safe for most projects.

Usage

pip install uritemplate

from uritemplate import URITemplate

t = URITemplate('https://api.github.com/users/{login}/gists{/gist_id}')
print(t.expand(login='sigmavirus24', gist_id='123456'))

Requires Python 3.9 or later.

Verdict: Production-ready RFC 6570 implementation with no dependencies, active maintenance, permissive licensing, and zero known vulnerabilities. Well-suited for API client libraries and URL templating tasks.

Needs verification

  • Performance characteristics when used with very large template sets or high-frequency expansion calls.
  • Compliance coverage for all RFC 6570 expression types and edge cases.
uri template expansionrfc 6570 implementationdynamic url constructionuri template variablesapi endpoint templatingurl parameter substitution

Similar packages