From 08ce1c3f351fa13e7586f239d81abac42a74cc00 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 00:45:44 +0200 Subject: [PATCH 01/13] fix #68: allow IPv6 literal in to_uri() --- src/hyperlink/_url.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/hyperlink/_url.py b/src/hyperlink/_url.py index 8797b5c..4d3cdad 100644 --- a/src/hyperlink/_url.py +++ b/src/hyperlink/_url.py @@ -1019,6 +1019,8 @@ def __init__( ) _, self._host = parse_host(_textcheck("host", host, "/?#@")) + # Compute only if needed + self._host_is_ipv6_literal = None if isinstance(path, Text): raise TypeError( "expected iterable of text for path, not: %r" % (path,) @@ -1188,6 +1190,22 @@ def user(self): """ return self.userinfo.split(u":")[0] + @property + def _host_idna_error(self): + # type: () -> bool + """Whether idna can encode the host + + idna does not encode empty strings and ipv6 addresses. + This is by design. + """ + if self._host_is_ipv6_literal is None: + try: + socket.inet_pton(socket.AF_INET6, self.host) + self._host_is_ipv6_literal = True + except OSError: + self._host_is_ipv6_literal = False + return self._host_is_ipv6_literal or not self.host + def authority(self, with_password=False, **kw): # type: (bool, Any) -> Text """Compute and return the appropriate host/port/userinfo combination. @@ -1669,7 +1687,7 @@ def to_uri(self): ) new_host = ( self.host - if not self.host + if self._host_idna_error else idna_encode(self.host, uts46=True).decode("ascii") ) return self.replace( From 35b687eeac8fc57f640d96f2f0f3b69620f86b8a Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 01:09:47 +0200 Subject: [PATCH 02/13] fix black job in test pipeline --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8865d17..a951a57 100644 --- a/tox.ini +++ b/tox.ini @@ -93,7 +93,8 @@ basepython = {[default]basepython} skip_install = True deps = - black==21.7b0 + black==21.12b0 + click==8.0.4 setenv = BLACK_LINT_ARGS=--check From b077d6fb19392e1ff7df6b44f4f288bd2ad34996 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 01:17:22 +0200 Subject: [PATCH 03/13] fixed typing for mypy tests --- src/hyperlink/_url.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hyperlink/_url.py b/src/hyperlink/_url.py index 4d3cdad..e37dd83 100644 --- a/src/hyperlink/_url.py +++ b/src/hyperlink/_url.py @@ -1019,8 +1019,6 @@ def __init__( ) _, self._host = parse_host(_textcheck("host", host, "/?#@")) - # Compute only if needed - self._host_is_ipv6_literal = None if isinstance(path, Text): raise TypeError( "expected iterable of text for path, not: %r" % (path,) @@ -1198,7 +1196,7 @@ def _host_idna_error(self): idna does not encode empty strings and ipv6 addresses. This is by design. """ - if self._host_is_ipv6_literal is None: + if not hasattr(self, "_host_is_ipv6_literal"): try: socket.inet_pton(socket.AF_INET6, self.host) self._host_is_ipv6_literal = True From 6c4e4b3b3aa1cfee2613879c48e7a593f1d4950c Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 01:37:38 +0200 Subject: [PATCH 04/13] fixed documentation job in test pipeline --- tox.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tox.ini b/tox.ini index a951a57..392e080 100644 --- a/tox.ini +++ b/tox.ini @@ -326,6 +326,12 @@ basepython = {[default]basepython} deps = Sphinx==4.1.2 sphinx-rtd-theme==0.5.2 + sphinxcontrib-applehelp==1.0.4 + sphinxcontrib-devhelp==1.0.2 + sphinxcontrib-devhelp==1.0.2 + sphinxcontrib-htmlhelp==2.0.1 + sphinxcontrib-qthelp==1.0.3 + sphinxcontrib-serializinghtml==1.1.5 commands = sphinx-build \ From e6aa04a87bbb7b630adce39a4a1caf4e8a722562 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:28:39 +0200 Subject: [PATCH 05/13] fixed packaging job in test pipeline --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 392e080..41de2b5 100644 --- a/tox.ini +++ b/tox.ini @@ -374,6 +374,7 @@ deps = check-manifest==0.46 readme-renderer==29.0 twine==3.4.2 + bleach==4.1.0 commands = check-manifest From 4f90a48357fd967bcb20c9c8e6693a08f9e31ee4 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:33:15 +0200 Subject: [PATCH 06/13] migrated upload artifact version to v4 --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index b5b7e9e..b67151a 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -215,7 +215,7 @@ jobs: - name: Upload pytest log artifact if: failure() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: pytest-logs path: pytest-logs.tgz From 549a3cdbc95d83607d2ad33a1cfd460599fca902 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:37:22 +0200 Subject: [PATCH 07/13] migrated setup python version to v5 --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index b67151a..a0ce2ec 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -189,7 +189,7 @@ jobs: uses: actions/checkout@v2 - name: Install Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} From f9c46a675c2543a936c83ef3a7a2bb66ef62200a Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:42:11 +0200 Subject: [PATCH 08/13] downgraded ubuntu version for tests --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a0ce2ec..7b8d8f9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -177,7 +177,7 @@ jobs: needs: [flake8, black, mypy, docs, packaging] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 timeout-minutes: 30 strategy: matrix: From c23099a9ae471202c9ea561ec80ee162dcf86b27 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:48:52 +0200 Subject: [PATCH 09/13] changed python runner, to allow tests for depreciated versions --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 7b8d8f9..38a7167 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -189,7 +189,7 @@ jobs: uses: actions/checkout@v2 - name: Install Python - uses: actions/setup-python@v5 + uses: MatteoH2O1999/setup-python@v4 with: python-version: ${{ matrix.python }} From dd3730a62d8b09138026e328f1b1ef3eba4b80da Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:51:50 +0200 Subject: [PATCH 10/13] fixed pypy version numbers --- .github/workflows/cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 38a7167..1f37187 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -177,11 +177,11 @@ jobs: needs: [flake8, black, mypy, docs, packaging] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 30 strategy: matrix: - python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy2", "pypy3"] + python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy2.7", "pypy3.9"] steps: From d1e74e0120258a2b746da6abf4629d9f19d9507c Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 02:56:01 +0200 Subject: [PATCH 11/13] temp: commented out pypy versions --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 1f37187..ac15a74 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -181,7 +181,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy2.7", "pypy3.9"] + python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9"]#, "pypy2.7", "pypy3.9"] steps: From 4a073859acb015cf202caf281d07a3575913d97e Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 03:10:47 +0200 Subject: [PATCH 12/13] temp: trying to get the pipeline debugged --- .github/workflows/cicd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ac15a74..3bfc26f 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -209,6 +209,7 @@ jobs: py_test="py${py/./}"; # Add "py" prefix, remove "." fi; env_test="test-${py_test}-coverage_xml"; + cat $env_test; echo "Test environment: ${env_test}"; tox -e "${env_test}"; tar cvzf pytest-logs.tgz ".tox/${env_test}/log"; From d519fdf10981c51afcd5840f71cdc4105d6e1c18 Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Thu, 26 Sep 2024 03:22:04 +0200 Subject: [PATCH 13/13] temp: trying to get the pipeline debugged --- .github/workflows/cicd.yml | 3 +-- tox.ini | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 3bfc26f..4393175 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -204,12 +204,11 @@ jobs: set -eux py="${{ matrix.python }}"; if [[ $py =~ pypy ]]; then # PyPy - py_test="${py}"; + py_test="${py/./}"; # remove "." else # CPython py_test="py${py/./}"; # Add "py" prefix, remove "." fi; env_test="test-${py_test}-coverage_xml"; - cat $env_test; echo "Test environment: ${env_test}"; tox -e "${env_test}"; tar cvzf pytest-logs.tgz ".tox/${env_test}/log"; diff --git a/tox.ini b/tox.ini index 41de2b5..712c942 100644 --- a/tox.ini +++ b/tox.ini @@ -44,28 +44,28 @@ basepython = py39: python3.9 py310: python3.10 - pypy2: pypy - pypy3: pypy3 + pypy27: pypy + pypy39: pypy3 deps = {[default]deps} # In Python 2, we need to pull in typing, mock - py{26,27,py2}: typing==3.10.0.0 - py{26,27,py2}: mock==3.0.5 # rq.filter: <4 + py{26,27,py27}: typing==3.10.0.0 + py{26,27,py27}: mock==3.0.5 # rq.filter: <4 # For pytest - py{26,27,34,py2}: pytest==4.6.11 # rq.filter: <5 - py{35,36,37,38,39,py3}: pytest==5.2.4 + py{26,27,34,py27}: pytest==4.6.11 # rq.filter: <5 + py{35,36,37,38,39,py39}: pytest==5.2.4 # For code coverage {[testenv:coverage_report]deps} - py{26,27,34,py2}: pytest-cov==2.8.1 # rq.filter: <2.9 - py{35,36,37,38,39,py3}: pytest-cov==2.10.1 + py{26,27,34,py27}: pytest-cov==2.8.1 # rq.filter: <2.9 + py{35,36,37,38,39,py39}: pytest-cov==2.10.1 # For hypothesis. Note Python 3.4 isn't supported by hypothesis. - py{26,27,py2}: hypothesis==4.43.9 # rq.filter: <4.44 - py{35,36,37,38,39,py3}: hypothesis==5.8.6 + py{26,27,py27}: hypothesis==4.43.9 # rq.filter: <4.44 + py{35,36,37,38,39,py39}: hypothesis==5.8.6 setenv = {[default]setenv}