Registry / http-networking / lazr-uri

lazr-uri

JSON →
library1.0.8pypypi✓ verified 85d ago

lazr-uri is a self-contained, easily reusable Python library designed for robust parsing, manipulation, and generation of Uniform Resource Identifiers (URIs). The current version is 1.0.7, released on December 9, 2024. The library maintains an infrequent release cadence, with updates typically addressing Python compatibility and internal optimizations.

pip install lazr-uri
INSTALL
IMPORT
SIG · LAZR-URI
L
lazr-uri
http-networkingpythonv1.0.8
Install
1.8s avg
Import
172ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.8 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.178s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.165s · 18MB
19MB installed
● package 19MB
Code
Verified usage

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

URI
from lazr.uri import URI
find_uris_in_text
from lazr.uri import find_uris_in_text

Demonstrates how to parse a URI, access its components, modify it, and extract multiple URIs from a block of text.

from lazr.uri import URI, find_uris_in_text # Parsing a URI and accessing its parts uri_str = "https://www.example.com:8080/path/to/resource?query=param&key=value#fragment" uri = URI(uri_str) print(f"Scheme: {uri.scheme}") print(f"Host: {uri.host}") print(f"Port: {uri.port}") print(f"Path: {uri.path}") print(f"Query: {uri.query}") print(f"Fragment: {uri.fragment}") # Manipulating a URI new_uri = uri.replace(scheme='http', port=None) print(f"Modified URI: {new_uri}") # Finding URIs within a text block text_with_uris = "Visit our site at http://example.org or email us at mailto:support@example.net." found_uris = list(find_uris_in_text(text_with_uris)) for found_uri in found_uris: print(f"Found URI: {found_uri}")
Debug
Known issues
breakingVersion 1.0.7 dropped support for Python versions 3.7 and below.
fix
Upgrade your Python environment to version 3.8 or higher. If unable to upgrade Python, use `lazr-uri<1.0.7`.
affects: >=1.0.7
gotchaPrior to version 1.0.6, `lazr.uri`'s versioning strategy imported `pkg_resources`, which could lead to significant performance overhead in large Python environments during startup.
fix
Upgrade to `lazr-uri` version 1.0.6 or newer to benefit from the adjusted versioning strategy that avoids `pkg_resources` for better performance.
affects: <1.0.6
Errors
Common errors & fixes
ImportError: cannot import name 'URI' from 'lazr.uri' (...)
This usually indicates an outdated version of `lazr-uri` or an issue with the Python environment where a module named `lazr.uri` exists but does not contain the `URI` class, or a namespace conflict.
fix
Ensure `lazr-uri` is correctly installed and up-to-date with `pip install --upgrade lazr-uri`. Verify no other packages are conflicting with the `lazr.uri` namespace.
AttributeError: 'URI' object has no attribute 'port' (when expecting a port from a URI without one)
When a URI string does not explicitly include a port, the 'port' attribute of the `URI` object will be `None`, leading to an `AttributeError` if you try to access methods or properties directly on it without checking if it's `None`.
fix
Always check if URI components like `uri.port` are `None` before attempting operations on them. Example: `if uri.port is not None: print(uri.port)`.
Upgrade
Version history
1.0.8latest on PyPI · released Apr 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lazr-uri — pip install lazr-uri · libregistry