Skip to content

Commit

Permalink
Merge branch 'master' into tests_aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Nov 21, 2024
2 parents bc78e56 + fc08cb8 commit 78838e3
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 100 deletions.
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ coverage:
paths:
- yarl/
target: 97.91%
packaging:
paths:
- packaging/
target: 75.24%
tests:
flags:
- pytest
Expand Down
10 changes: 5 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ show_contexts = true
skip_covered = false

[paths]
source =
yarl
*/lib/pypy*/site-packages/yarl
*/lib/python*/site-packages/yarl
*/Lib/site-packages/yarl
_site-packages-to-src-mapping =
.
*/lib/pypy*/site-packages
*/lib/python*/site-packages
*\Lib\site-packages

[report]
fail_under = 98.95
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
lint:
uses: ./.github/workflows/reusable-linters.yml
secrets:
codecov-token: 26f4a393-24a9-48d9-8fa4-f1344d930846
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build-wheels-for-tested-arches:
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
Expand Down Expand Up @@ -345,17 +345,17 @@ jobs:
- name: Send coverage data to Codecov
if: >-
!cancelled()
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: 26f4a393-24a9-48d9-8fa4-f1344d930846
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: >-
CI-GHA,
pytest,
OS-${{ runner.os }},
VM-${{ matrix.os }},
Py-${{ steps.python-install.outputs.python-version }}
fail_ci_if_error: false
fail_ci_if_error: true

benchmark:
name: Benchmark
Expand Down Expand Up @@ -552,8 +552,6 @@ jobs:
- name: >-
Publish 🐍📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
make lint
- name: Send coverage data to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.codecov-token }}
files: >-
Expand All @@ -70,7 +70,7 @@ jobs:
flags: >-
CI-GHA,
MyPy
fail_ci_if_error: false
fail_ci_if_error: true
- name: Install spell checker
run: |
sudo apt install libenchant-2-dev
Expand Down
56 changes: 56 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,62 @@ Changelog

.. towncrier release notes start
1.17.2
======

*(2024-11-17)*


Bug fixes
---------

- Stopped implicitly allowing the use of Cython pre-release versions when
building the distribution package -- by :user:`ajsanchezsanz` and
:user:`markgreene74`.

*Related issues and pull requests on GitHub:*
:issue:`1411`, :issue:`1412`.

- Fixed a bug causing :attr:`~yarl.URL.port` to return the default port when the given port was zero
-- by :user:`gmacon`.

*Related issues and pull requests on GitHub:*
:issue:`1413`.


Features
--------

- Make error messages include details of incorrect type when ``port`` is not int in :py:meth:`~yarl.URL.build`.
-- by :user:`Cycloctane`.

*Related issues and pull requests on GitHub:*
:issue:`1414`.


Packaging updates and notes for downstreams
-------------------------------------------

- Stopped implicitly allowing the use of Cython pre-release versions when
building the distribution package -- by :user:`ajsanchezsanz` and
:user:`markgreene74`.

*Related issues and pull requests on GitHub:*
:issue:`1411`, :issue:`1412`.


Miscellaneous internal changes
------------------------------

- Improved performance of the :py:meth:`~yarl.URL.joinpath` method -- by :user:`bdraco`.

*Related issues and pull requests on GitHub:*
:issue:`1418`.


----


1.17.1
======

Expand Down
1 change: 1 addition & 0 deletions CHANGES/111.feature.rst
2 changes: 0 additions & 2 deletions CHANGES/1413.bugfix.rst

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGES/1414.feature.rst

This file was deleted.

1 change: 1 addition & 0 deletions CHANGES/1421.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added ``keep_query`` and ``keep_fragment`` flags in the :py:meth:`yarl.URL.with_path`, :py:meth:`yarl.URL.with_name` and :py:meth:`yarl.URL.with_suffix` methods, allowing users to optionally retain the query string and fragment in the resulting URL when replacing the path -- by :user:`paul-nameless`.
1 change: 1 addition & 0 deletions CHANGES/1422.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved performance of converting :class:`~yarl.URL` to a string -- by :user:`bdraco`.
5 changes: 4 additions & 1 deletion CHANGES/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ for the users to understand what it means.
combined with others, it will be a part of the "news digest"
telling the readers **what changed** in a specific version of
the library *since the previous version*. You should also use
reStructuredText syntax for highlighting code (inline or block),
*reStructuredText* syntax for highlighting code (inline or block),
linking parts of the docs or external sites.
However, you do not need to reference the issue or PR numbers here
as *towncrier* will automatically add a reference to all of the
affected issues when rendering the news file.
If you wish to sign your change, feel free to add ``-- by
:user:`github-username``` at the end (replace ``github-username``
with your own!).
Expand Down
24 changes: 21 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,16 @@ section generates a new :class:`URL` instance.
>>> URL('http://example.com:8888').with_port(None)
URL('http://example.com')

.. method:: URL.with_path(path)
.. method:: URL.with_path(path, *, keep_query=False, keep_fragment=False)

Return a new URL with *path* replaced, encode *path* if needed.

If ``keep_query=True`` or ``keep_fragment=True`` it retains the existing query or fragment in the URL.

.. versionchanged:: 1.18

Added *keep_query* and *keep_fragment* parameters.

.. doctest::

>>> URL('http://example.com/').with_path('/path/to')
Expand Down Expand Up @@ -857,27 +863,39 @@ section generates a new :class:`URL` instance.
>>> URL('http://example.com/path#frag').with_fragment(None)
URL('http://example.com/path')

.. method:: URL.with_name(name)
.. method:: URL.with_name(name, *, keep_query=False, keep_fragment=False)

Return a new URL with *name* (last part of *path*) replaced and
cleaned up *query* and *fragment* parts.

Name is encoded if needed.

If ``keep_query=True`` or ``keep_fragment=True`` it retains the existing query or fragment in the URL.

.. versionchanged:: 1.18

Added *keep_query* and *keep_fragment* parameters.

.. doctest::

>>> URL('http://example.com/path/to?arg#frag').with_name('new')
URL('http://example.com/path/new')
>>> URL('http://example.com/path/to').with_name("ім'я")
URL('http://example.com/path/%D1%96%D0%BC%27%D1%8F')

.. method:: URL.with_suffix(suffix)
.. method:: URL.with_suffix(suffix, *, keep_query=False, keep_fragment=False)

Return a new URL with *suffix* (file extension of *name*) replaced and
cleaned up *query* and *fragment* parts.

Name is encoded if needed.

If ``keep_query=True`` or ``keep_fragment=True`` it retains the existing query or fragment in the URL.

.. versionchanged:: 1.18

Added *keep_query* and *keep_fragment* parameters.

.. doctest::

>>> URL('http://example.com/path/to?arg#frag').with_suffix('.doc')
Expand Down
8 changes: 2 additions & 6 deletions packaging/pep517_backend/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from shutil import copytree
from sys import implementation as _system_implementation
from sys import stderr as _standard_error_stream
from sys import version_info as _python_version_tuple
from tempfile import TemporaryDirectory
from warnings import warn as _warn_that

Expand Down Expand Up @@ -82,9 +81,6 @@
PURE_PYTHON_ENV_VAR = 'YARL_NO_EXTENSIONS'
"""Environment variable name toggle used to opt out of making C-exts."""

IS_PY3_12_PLUS = _python_version_tuple[:2] >= (3, 12)
"""A flag meaning that the current runtime is Python 3.12 or higher."""

IS_CPYTHON = _system_implementation.name == "cpython"
"""A flag meaning that the current interpreter implementation is CPython."""

Expand Down Expand Up @@ -378,8 +374,8 @@ def get_requires_for_build_wheel(
)

c_ext_build_deps = [] if is_pure_python_build else [
'Cython >= 3.0.0b3' if IS_PY3_12_PLUS # Only Cython 3+ is compatible
else 'Cython',
'Cython ~= 3.0.0; python_version >= "3.12"',
'Cython; python_version < "3.12"',
]

return _setuptools_get_requires_for_build_wheel(
Expand Down
6 changes: 2 additions & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ addopts =
# https://docs.pytest.org/en/stable/doctest.html
--doctest-modules

# Dump the test results in junit format:
# --junitxml=.test-results/pytest/results.xml

# Pre-load the `pytest-cov` plugin early:
-p pytest_cov

# `pytest-cov`:
--cov
--cov-context=test
--cov-config=.coveragerc
--cov-context=test

# Fail on config parsing warnings:
# --strict-config
Expand Down Expand Up @@ -73,6 +70,7 @@ norecursedirs =
build
dist
docs
requirements
venv
virtualenv
yarl.egg-info
Expand Down
Loading

0 comments on commit 78838e3

Please sign in to comment.