Registry / http-networking / urlpath

urlpath

JSON →
library2.0.0pypypi✓ verified 85d ago

Object-oriented URL classes built on urllib.parse and pathlib for Python 3.9+. Version 2.0.0 switches license from PSF to MIT, drops support for Python 3.4-3.8, and restructures from a single-file module to a multi-module package. Generally stable with infrequent releases.

pip install urlpath
INSTALL
IMPORT
SIG · URLPATH
U
urlpath
http-networkingpythonv2.0.0
Install
2.1s avg
Import
925ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.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.103.95 runs
installs and imports cleanly · install 0.0s · import 0.976s · 21.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.874s · 22MB
19MB installed
● package 19MB
Code
Verified usage

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

URL
from urlpath import URL
import urlpath urlpath.URL('/path')
Common mistake: using old single-file import style before v2.0.0 restructured the package.

Basic usage of URL class with path joining and query parameters.

from urlpath import URL url = URL('https://api.example.com/resource/123') print(url.scheme) # 'https' print(url.host) # 'api.example.com' print(url.path) # '/resource/123' print(url.parent()) # URL('https://api.example.com/resource') print(url.name) # '123' # Chaining new_url = url / 'sub' / 'item' print(new_url) # 'https://api.example.com/resource/123/sub/item' # Query params query_url = URL('https://example.com/search').with_query({'q': 'test', 'page': '1'}) print(query_url) # 'https://example.com/search?q=test&page=1' # Check if URL is absolute print(url.is_absolute()) # True
Debug
Known issues
breakingIn v2.0.0 the package changed from a single-file module to a multi-module package. Any code relying on internal module paths (e.g., importing directly from 'urlpath.py' or accessing private attributes) may break.
fix
Update imports to use the public API from 'urlpath' (e.g., 'from urlpath import URL').
affects: >=2.0.0
deprecatedPython 3.8 and earlier are no longer supported. The package requires Python 3.9+.
fix
Upgrade Python to 3.9 or later.
affects: >=2.0.0
gotchaURL path operations (like '/' for joining) return a new URL object, not a string. Forgetting to call str() or print() can lead to confusing output.
fix
Convert URL to string with str(url) or use .url attribute to get the full string representation.
affects: all
Errors
Common errors & fixes
AttributeError: module 'urlpath' has no attribute 'URL'
Importing the module instead of the class from it (old style before v2.0.0).
fix
Use 'from urlpath import URL' instead of 'import urlpath' then 'urlpath.URL'.
AttributeError: 'str' object has no attribute 'parent'
Treating a string as a URL object. Path operations return a URL, not a string.
fix
Create a URL object first: url = URL('https://example.com') then call url.parent().
TypeError: expected str, bytes or os.PathLike object, not URL
Using a URL object where a string is expected (e.g., as argument to os.path functions).
fix
Convert URL to string via str(url) or url.url before passing to non-urlpath functions.
Upgrade
Version history
2.0.0latest on PyPI · released Oct 13, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
urlpath — pip install urlpath · libregistry