Skip to content

Releases: aio-libs/yarl

1.9.5

31 Aug 02:44
10635f8
Compare
Choose a tag to compare

Bug fixes

  • Joining URLs with empty segments has been changed
    to match :rfc:3986.

    Previously empty segments would be removed from path,
    breaking use-cases such as

    .. code-block:: python

    URL("https://web.archive.org/web/") / "https://github.com/"

    Now :meth:/ operation <yarl.URL.__truediv__> and :meth:URL.joinpath() <yarl.URL.joinpath>
    keep empty segments, but do not introduce new empty segments.
    e.g.

    .. code-block:: python

    URL("https://example.org/") / ""

    does not introduce an empty segment.

    -- by :user:commonism and :user:youtux

    Related issues and pull requests on GitHub:
    #1026.

  • The default protocol ports of well-known URI schemes are now taken into account
    during the normalization of the URL string representation in accordance with
    :rfc:3986#section-3.2.3.

    Specified ports are removed from the :class:str representation of a :class:~yarl.URL
    if the port matches the scheme's default port -- by :user:commonism.

    Related issues and pull requests on GitHub:
    #1033.

  • :meth:URL.join() <yarl.URL.join> has been changed to match
    :rfc:3986 and align with
    :meth:/ operation <yarl.URL.__truediv__> and :meth:URL.joinpath() <yarl.URL.joinpath>
    when joining URLs with empty segments.
    Previously :py:func:urllib.parse.urljoin was used,
    which has known issues with empty segments
    (python/cpython#84774 <https://github.com/python/cpython/issues/84774>_).

    Due to the semantics of :meth:URL.join() <yarl.URL.join>, joining an
    URL with scheme requires making it relative, prefixing with ./.

    .. code-block:: pycon

    URL("https://web.archive.org/web/").join(URL("./https://github.com/aio-libs/yarl"))
    URL('https://web.archive.org/web/https://github.com/aio-libs/yarl')

    Empty segments are honored in the base as well as the joined part.

    .. code-block:: pycon

    URL("https://web.archive.org/web/https://").join(URL("github.com/aio-libs/yarl"))
    URL('https://web.archive.org/web/https://github.com/aio-libs/yarl')

    -- by :user:commonism

    Related issues and pull requests on GitHub:
    #1039.

Removals and backward incompatible breaking changes

  • Stopped decoding %2F (/) in URL.path, as this could lead to code incorrectly treating it as a path separator
    -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #1057.

Improved documentation

  • On the :doc:Contributing docs <contributing/guidelines> page,
    a link to the Towncrier philosophy has been fixed.

    Related issues and pull requests on GitHub:
    #981.

  • The pre-existing :meth:/ magic method <yarl.URL.__truediv__>
    has been documented in the API reference -- by :user:commonism.

    Related issues and pull requests on GitHub:
    #1026.

Packaging updates and notes for downstreams

  • A flaw in the logic for copying the project directory into a
    temporary folder that led to infinite recursion when :envvar:TMPDIR
    was set to a project subdirectory path. This was happening in Fedora
    and its downstream due to the use of pyproject-rpm-macros <https://src.fedoraproject.org/rpms/pyproject-rpm-macros>__. It was
    only reproducible with pip wheel and was not affecting the
    pyproject-build users.

    -- by :user:hroncok and :user:webknjaz

    Related issues and pull requests on GitHub:
    #992, #1014.

  • Support Python 3.13 and publish non-free-threaded wheels

    Related issues and pull requests on GitHub:
    #1054.

Contributor-facing changes

  • The CI/CD setup has been updated to test arm64 wheels
    under macOS 14, except for Python 3.7 that is unsupported
    in that environment -- by :user:webknjaz.

    Related issues and pull requests on GitHub:
    #1015.

  • Removed unused type ignores and casts -- by :user:hauntsaninja.

    Related issues and pull requests on GitHub:
    #1031.

Miscellaneous internal changes

  • port, scheme, and raw_host are now cached_property -- by :user:bdraco.

    aiohttp accesses these properties quite often, which cause :mod:urllib to build the _hostinfo property every time. port, scheme, and raw_host are now cached properties, which will improve performance.

    Related issues and pull requests on GitHub:
    #1044, #1058.

1.9.4

06 Dec 12:48
v1.9.4
6362ff1
Compare
Choose a tag to compare

Bug fixes

  • Started raising :py:exc:TypeError when a string value is passed into
    :py:meth:~yarl.URL.build as the port argument -- by :user:commonism.

    Previously the empty string as port would create malformed URLs when rendered as string representations. (#883)

Packaging updates and notes for downstreams

  • The leading -- has been dropped from the :pep:517 in-tree build
    backend config setting names. --pure-python is now just pure-python
    -- by :user:webknjaz.

    The usage now looks as follows:

    .. code-block:: console

    $ python -m build \
        --config-setting=pure-python=true \
        --config-setting=with-cython-tracing=true
    

    (#963)

Contributor-facing changes

  • A step-by-step :doc:Release Guide <contributing/release_guide> guide has
    been added, describing how to release yarl -- by :user:webknjaz.

    This is primarily targeting maintainers. (#960)

  • Coverage collection has been implemented for the Cython modules
    -- by :user:webknjaz.

    It will also be reported to Codecov from any non-release CI jobs.

    To measure coverage in a development environment, yarl can be
    installed in editable mode, which requires an environment variable
    YARL_CYTHON_TRACING=1 to be set:

    .. code-block:: console

    $ YARL_CYTHON_TRACING=1 python -Im pip install -e .
    

    Editable install produces C-files required for the Cython coverage
    plugin to map the measurements back to the PYX-files. (#961)

  • It is now possible to request line tracing in Cython builds using the
    with-cython-tracing :pep:517 config setting
    -- :user:webknjaz.

    This can be used in CI and development environment to measure coverage
    on Cython modules, but is not normally useful to the end-users or
    downstream packagers.

    Here's a usage example:

    .. code-block:: console

    $ python -Im pip install . --config-settings=with-cython-tracing=true
    

    For editable installs, this setting is on by default. Otherwise, it's
    off unless requested explicitly. (#962)

1.9.3

20 Nov 21:59
v1.9.3
0698dc9
Compare
Choose a tag to compare

🐛 Bug fixes

  • Stopped dropping trailing slashes in yarl.URL.joinpath() -- by @gmacon. (#862, #866)
  • Started accepting string subclasses in __truediv__() operations (URL / segment) -- by @mjpieters. (#871, #884)
  • Fixed the human representation of URLs with square brackets in usernames and passwords -- by @mjpieters. (#876, #882)
  • Updated type hints to include URL.missing_port(), URL.__bytes__() and the encoding argument to yarl.URL.joinpath() -- by @mjpieters. (#891)

📦 Packaging updates and notes for downstreams

  • Integrated Cython 3 to enable building yarl under Python 3.12 -- by @mjpieters. (#829, #881)

  • Added the changelog URL to the dist metadata -- by @scop. (#877)

  • Declared modern setuptools.build_meta as the :pep:517 build backend in pyproject.toml explicitly -- by @webknjaz. (#886)

  • Converted most of the packaging setup into a declarative setup.cfg config -- by @webknjaz. (#890)

  • Replaced the packaging is replaced from an old-fashioned setup.py to an in-tree :pep:517 build backend -- by @webknjaz.

    Whenever the end-users or downstream packagers need to build yarl from source (a Git checkout or an sdist), they may pass a config_settings flag --pure-python. If this flag is not set, a C-extension will be built and included into the distribution.

    Here is how this can be done with pip:

    $ python -m pip install . --config-settings=--pure-python=

    This will also work with -e | --editable.

    The same can be achieved via pypa/build:

    $ python -m build --config-setting=--pure-python=

    Adding -w | --wheel can force pypa/build produce a wheel from source directly, as opposed to building an sdist and then building from it. (#893)

  • Declared Python 3.12 supported officially in the distribution package metadata -- by @edgarrmondragon. (#942)

🛠️ Contributor-facing changes

  • A regression test for no-host URLs was added per #821 and RFC 3986 -- by @kenballus. (#821, #822)

  • Started testing yarl against Python 3.12 in CI -- by @mjpieters. (#881)

  • All Python 3.12 jobs are now marked as required to pass in CI -- by @edgarrmondragon. (#942)

  • MyST is now integrated in Sphinx -- by @webknjaz.

    This allows the contributors to author new documents in Markdown when they have difficulties with going straight RST. (#953)

💪 New Contributors

🪞 Full Diff: v1.9.2...v1.9.3

1.9.2

25 Apr 19:10
v1.9.2
cfc634e
Compare
Choose a tag to compare

Bugfixes

  • Fix regression with truediv and absolute URLs with empty paths causing the raw path to lack the leading /. ((#854)_)

1.9.1

21 Apr 16:04
6f06f5c
Compare
Choose a tag to compare

Bugfixes

  • Marked tests that fail on older Python patch releases (< 3.7.10, < 3.8.8 and < 3.9.2) as expected to fail due to missing a security fix for CVE-2021-23336. ((#850)_)

1.8.2

03 Dec 04:50
v1.8.2
def4970
Compare
Choose a tag to compare

This is the first release that started shipping wheels for Python 3.11.

1.8.1

02 Aug 07:14
v1.8.1
68e7d93
Compare
Choose a tag to compare

Misc

1.8.0

01 Aug 19:09
v1.8.0
51a5483
Compare
Choose a tag to compare

Features

  • Added URL.raw_suffix, URL.suffix, URL.raw_suffixes, URL.suffixes, URL.with_suffix. ((#613)_)

Improved Documentation

  • Fixed broken internal references to :meth:~URL.human_repr. ((#665)_)
  • Fixed broken external references to :doc:multidict:index docs. ((#665)_)

Deprecations and Removals

  • Dropped Python 3.6 support. ((#672)_)

Misc

v1.7.2

01 Nov 20:25
Compare
Choose a tag to compare

Bugfixes

  • Changed call in with_port() to stop reencoding parts of the URL that were already encoded. ((#623)_)

v1.7.1

07 Oct 11:49
Compare
Choose a tag to compare

Bugfixes

  • Fix 1.7.0 build error