Catalog PyPI
Back to packageRELEASE DETAILS

4.0.0

PyPI

ada-url

URL parser and manipulator based on the WHAT WG URL standard

Published28 Jul 2026
Direct dependencies1
Transitive dependenciesNot calculated

README

Version 4.0.0 documentation
ada-url
========

This is ``ada_url``, a fast standard-compliant Python library for working with URLs based on the ``Ada`` URL
parser.

* `Documentation <https://ada-url.readthedocs.io>`__
* `Development <https://github.com/ada-url/ada-python/>`__
* `Ada <https://www.ada-url.com/>`__ 

Installation
------------

Install from `PyPI <https://pypi.org/project/ada-url/>`__:

.. code-block:: sh

    pip install ada_url

Usage examples
--------------

Parsing URLs
^^^^^^^^^^^^

The ``URL`` class is intended to match the one described in the
`WHATWG URL spec <https://url.spec.whatwg.org/#url-class>`_.

.. code-block:: python

    >>> from ada_url import URL
    >>> urlobj = URL('https://example.org/path/../file.txt')
    >>> urlobj.href
    'https://example.org/path/file.txt'

The ``parse_url`` function returns a dictionary of all URL elements:

.. code-block:: python

    >>> from ada_url import parse_url
    >>> parse_url('https://user:pass@example.org:80/api?q=1#2')
    {
        'href': 'https://user:pass@example.org:80/api?q=1#2',
        'username': 'user',
        'password': 'pass',
        'protocol': 'https:',
        'port': '80',
        'hostname': 'example.org',
        'host': 'example.org:80',
        'pathname': '/api',
        'search': '?q=1',
        'hash': '#2',
        'origin': 'https://example.org:80',
        'host_type': <HostType.DEFAULT: 0>,
        'scheme_type': <SchemeType.HTTPS: 2>
    }

Altering URLs
^^^^^^^^^^^^^

Replacing URL components with the ``URL`` class:

.. code-block:: python

    >>> from ada_url import URL
    >>> urlobj = URL('https://example.org/path/../file.txt')
    >>> urlobj.host = 'example.com'
    >>> urlobj.href
    'https://example.com/file.txt'

Replacing URL components with the ``replace_url`` function:

    >>> from ada_url import replace_url
    >>> replace_url('https://example.org/path/../file.txt', host='example.com')
    'https://example.com/file.txt'

Search parameters
^^^^^^^^^^^^^^^^^

The ``URLSearchParams`` class is intended to match the one described in the
`WHATWG URL spec <https://url.spec.whatwg.org/#interface-urlsearchparams>`__.

.. code-block:: python

    >>> from ada_url import URLSearchParams
    >>> obj = URLSearchParams('key1=value1&key2=value2')
    >>> list(obj.items())
    [('key1', 'value1'), ('key2', 'value2')]

The ``parse_search_params`` function returns a dictionary of search keys mapped to
value lists:

.. code-block:: python

    >>> from ada_url import parse_search_params
    >>> parse_search_params('key1=value1&key2=value2')
    {'key1': ['value1'], 'key2': ['value2']}

Internationalized domain names
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``idna`` class can encode and decode IDNs:

.. code-block:: python

    >>> from ada_url import idna
    >>> idna.encode('Bücher.example')
    b'xn--bcher-kva.example'
    >>> idna.decode(b'xn--bcher-kva.example')
    'bücher.example'

WHATWG URL compliance
---------------------

This library is compliant with the WHATWG URL spec. This means, among other things,
that it properly encodes IDNs and resolves paths:

.. code-block:: python

    >>> from ada_url import URL
    >>> parsed_url = URL('https://www.GOoglé.com/./path/../path2/')
    >>> parsed_url.hostname
    'www.xn--googl-fsa.com'
    >>> parsed_url.pathname
    '/path2/'

Contrast that with the Python standard library's ``urllib.parse`` module, which loosely
follows the older `RFC 3978 <https://datatracker.ietf.org/doc/html/rfc3978>`__ standard:

.. code-block:: python

    >>> from urllib.parse import urlparse
    >>> parsed_url = urlparse('https://www.GOoglé.com/./path/../path2/')
    >>> parsed_url.hostname
    'www.googlé.com'
    >>> parsed_url.path
    '/./path/../path2/'

Performance
-----------

This package uses `CFFI <https://github.com/ada-url/ada-python/>`__ to call
the ``Ada`` C library's functions, which makes it faster than the Python standard
library's ``urllib.parse`` module for most applications.

An alternative package, `can_ada <https://github.com/tktech/can_ada>`__, uses
`pybind11 <https://pybind11.readthedocs.io/en/stable/>`__ to interact with the ``Ada``
C++ library functions, which is even faster.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
cffi
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
cffiruntime

Distribution files

41 collected
ada_url-4.0.0-cp310-cp310-macosx_10_15_universal2.whl

bdist_wheel · 685.18 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-macosx_10_15_x86_64.whl

bdist_wheel · 474.87 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-macosx_11_0_arm64.whl

bdist_wheel · 470.23 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

bdist_wheel · 1,787 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

bdist_wheel · 1,817.6 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-musllinux_1_2_aarch64.whl

bdist_wheel · 2,702.66 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-musllinux_1_2_x86_64.whl

bdist_wheel · 2,808.72 KB · Python cp310

Source file
ada_url-4.0.0-cp310-cp310-win_amd64.whl

bdist_wheel · 423.87 KB · Python cp310

Source file
ada_url-4.0.0-cp311-cp311-macosx_10_15_universal2.whl

bdist_wheel · 685.17 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-macosx_10_15_x86_64.whl

bdist_wheel · 474.87 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-macosx_11_0_arm64.whl

bdist_wheel · 470.23 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

bdist_wheel · 1,786.95 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

bdist_wheel · 1,817.61 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-musllinux_1_2_aarch64.whl

bdist_wheel · 2,702.66 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-musllinux_1_2_x86_64.whl

bdist_wheel · 2,808.69 KB · Python cp311

Source file
ada_url-4.0.0-cp311-cp311-win_amd64.whl

bdist_wheel · 423.87 KB · Python cp311

Source file
ada_url-4.0.0-cp312-cp312-macosx_10_15_universal2.whl

bdist_wheel · 689.64 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-macosx_10_15_x86_64.whl

bdist_wheel · 476.95 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-macosx_11_0_arm64.whl

bdist_wheel · 472.39 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

bdist_wheel · 1,787.44 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

bdist_wheel · 1,818.28 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-musllinux_1_2_aarch64.whl

bdist_wheel · 2,703.49 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-musllinux_1_2_x86_64.whl

bdist_wheel · 2,809.89 KB · Python cp312

Source file
ada_url-4.0.0-cp312-cp312-win_amd64.whl

bdist_wheel · 423.95 KB · Python cp312

Source file
ada_url-4.0.0-cp313-cp313-macosx_10_15_universal2.whl

bdist_wheel · 689.64 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-macosx_10_15_x86_64.whl

bdist_wheel · 476.95 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-macosx_11_0_arm64.whl

bdist_wheel · 472.39 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

bdist_wheel · 1,787.41 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

bdist_wheel · 1,818.29 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-musllinux_1_2_aarch64.whl

bdist_wheel · 2,703.45 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-musllinux_1_2_x86_64.whl

bdist_wheel · 2,809.89 KB · Python cp313

Source file
ada_url-4.0.0-cp313-cp313-win_amd64.whl

bdist_wheel · 423.96 KB · Python cp313

Source file
ada_url-4.0.0-cp314-cp314-macosx_10_15_universal2.whl

bdist_wheel · 689.8 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-macosx_10_15_x86_64.whl

bdist_wheel · 476.96 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-macosx_11_0_arm64.whl

bdist_wheel · 472.48 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

bdist_wheel · 1,787.11 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

bdist_wheel · 1,818.1 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-musllinux_1_2_aarch64.whl

bdist_wheel · 2,703.08 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-musllinux_1_2_x86_64.whl

bdist_wheel · 2,810.21 KB · Python cp314

Source file
ada_url-4.0.0-cp314-cp314-win_amd64.whl

bdist_wheel · 428.2 KB · Python cp314

Source file
ada_url-4.0.0.tar.gz

sdist · 259.11 KB · Python source

Source file

Repository

PENDING
ada-url/ada-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:426f6856d0aa7ec714c2f18ade8eef9fd41e7e4e8a4131824123db378c4408c5

Other collected versions

View all collected versions →