Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kjd/idna
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.7
Choose a base ref
...
head repository: kjd/idna
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.8
Choose a head ref

Commits on Apr 24, 2024

  1. Copy the full SHA
    b0d8f3c View commit details
  2. Merge pull request #176 from kjd/issue-174

    Restore IDNAError exception for codepoints that don't exist in Unicode (fixes #174)
    kjd authored Apr 24, 2024
    Copy the full SHA
    5b78296 View commit details

Commits on Aug 2, 2024

  1. Copy the full SHA
    260bc60 View commit details
  2. Add support for Python 3.13

    hugovk committed Aug 2, 2024
    Copy the full SHA
    461f610 View commit details
  3. Copy the full SHA
    c0fa076 View commit details
  4. Bump GitHub Actions

    hugovk committed Aug 2, 2024
    Copy the full SHA
    1797e96 View commit details
  5. Merge pull request #181 from hugovk/add-3.13

    Add support for Python 3.13, drop untestable EOL 3.5
    kjd authored Aug 2, 2024
    Copy the full SHA
    dd2a815 View commit details
  6. Copy the full SHA
    0ba2f99 View commit details
  7. Copy the full SHA
    0ab935a View commit details

Commits on Aug 3, 2024

  1. Copy the full SHA
    6d9f14e View commit details
  2. Copy the full SHA
    e98f6b8 View commit details
  3. Rename idna* to idna_preflight*

    kjd committed Aug 3, 2024
    Copy the full SHA
    1361c16 View commit details
  4. Use actions/download-artifact@v4

    kjd committed Aug 3, 2024
    Copy the full SHA
    7e2073a View commit details
  5. Copy the full SHA
    b8d9784 View commit details

Commits on Aug 16, 2024

  1. Copy the full SHA
    613bdde View commit details

Commits on Aug 22, 2024

  1. Do not try to build/send packages to TestPyPI for now

    We don't have access to test.pypi.org to do this for now as someone
    else has claimed this project. Have opened at ticket at
    pypi/support#4484 to remedy but looks like
    there is a ~6 month backlog so unlikely to get relief soon.
    kjd committed Aug 22, 2024
    Copy the full SHA
    f8a8de4 View commit details
  2. Copy the full SHA
    c109d3a View commit details
  3. Pin Github Actions dependencies

    kjd committed Aug 22, 2024
    Copy the full SHA
    e1a1541 View commit details
  4. Merge pull request #182 from kjd/github-pypi-actions

    Implement current best practice for using Github Actions for package building and PyPI distribution
    kjd authored Aug 22, 2024
    Copy the full SHA
    12d4dd1 View commit details
  5. Copy the full SHA
    a87e2b6 View commit details
  6. Copy the full SHA
    1f613c5 View commit details

Commits on Aug 23, 2024

  1. Copy the full SHA
    a2b41c3 View commit details
  2. Typo fix

    kjd committed Aug 23, 2024
    Copy the full SHA
    28c7c9e View commit details
  3. Release v3.8

    kjd committed Aug 23, 2024
    Copy the full SHA
    784c6f4 View commit details
Showing with 150 additions and 47 deletions.
  1. +107 −25 .github/workflows/deploy.yml
  2. +8 −6 .github/workflows/python-package.yml
  3. +3 −3 .github/workflows/scorecard.yml
  4. +12 −0 HISTORY.rst
  5. +7 −5 README.rst
  6. +6 −2 idna/core.py
  7. +1 −1 idna/package_data.py
  8. +2 −2 pyproject.toml
  9. +2 −2 setup.cfg
  10. +1 −0 tests/test_idna.py
  11. +1 −1 tools/idna-data
132 changes: 107 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,117 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: "Publish to PyPI"

on:
push:
tags:
- "*"
# Adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

name: Publish to PyPI
on: push
permissions:
contents: "read"
contents: read

jobs:
publish:
name: "Publish to PyPI"
runs-on: "ubuntu-latest"

build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5
with:
python-version: "3.x"
- name: Install pypa/build
run: python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: "publish"
name: pypi
url: https://pypi.org/p/idna # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: "Checkout repository"
uses: "actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b"
- name: Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # release/v1

github-release:
name: Sign and upload GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

- name: "Setup Python"
uses: "actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5"
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
python-version: "3.x"
name: python-package-distributions
path: dist/
- name: Sign with Sigstore
uses: sigstore/gh-action-sigstore-python@1f6a500bbfdd9a2a339cf033e5421951fbc1cd2 # v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
# publish-to-testpypi:
# name: Publish to Test PyPI
# needs:
# - build
# runs-on: ubuntu-latest

# environment:
# name: testpypi
# url: https://test.pypi.org/p/idna

- name: "Build dists"
run: |
python -m pip install build
python -m build
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing

- name: "Publish to PyPI"
uses: "pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f"
# steps:
# - name: Download all the dists
# uses: actions/download-artifact@v4
# with:
# name: python-package-distributions
# path: dist/
# - name: Publish distribution to TestPyPI
# uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # release/v1
# with:
# verbose: true
# print-hash: true
# repository-url: https://test.pypi.org/legacy/
14 changes: 8 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -13,18 +13,20 @@ permissions:
jobs:
mypy:
strategy:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
@@ -35,6 +37,7 @@ jobs:

build:
strategy:
fail-fast: false
matrix:
python-version:
- '3.7'
@@ -43,17 +46,16 @@ jobs:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy-3.9'
include:
- python-version: 3.5
os: ubuntu-20.04
- python-version: 3.6
os: ubuntu-20.04
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
6 changes: 3 additions & 3 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -25,12 +25,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@a46b90b4caca61e2298cc4a9bd4c90d3dfe7f09d # v2.4.0
with:
results_file: results.sarif
results_format: sarif
@@ -47,7 +47,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4
with:
name: SARIF file
path: results.sarif
12 changes: 12 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -3,6 +3,18 @@
History
-------

3.8 (2024-08-23)
++++++++++++++++

- Fix regression where IDNAError exception was not being produced for
certain inputs.
- Add support for Python 3.13, drop support for Python 3.5 as it is no
longer testable.
- Documentation improvements
- Updates to package testing using Github actions

Thanks to Hugo van Kemenade for contributions to this release.

3.7 (2024-04-11)
++++++++++++++++

12 changes: 7 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -83,7 +83,9 @@ This library provides one such mapping that was developed by the
Unicode Consortium. Known as `Unicode IDNA Compatibility Processing
<https://unicode.org/reports/tr46/>`_, it provides for both a regular
mapping for typical applications, as well as a transitional mapping to
help migrate from older IDNA 2003 applications.
help migrate from older IDNA 2003 applications. Strings are
preprocessed according to Section 4.4 “Preprocessing for IDNA2008”
prior to the IDNA operations.

For example, “Königsgäßchen” is not a permissible label as *LATIN
CAPITAL LETTER K* is not allowed (nor are capital letters in general).
@@ -183,17 +185,17 @@ Additional Notes
* **Packages**. The latest tagged release version is published in the
`Python Package Index <https://pypi.org/project/idna/>`_.

* **Version support**. This library supports Python 3.5 and higher.
* **Version support**. This library supports Python 3.6 and higher.
As this library serves as a low-level toolkit for a variety of
applications, many of which strive for broad compatibility with older
Python versions, there is no rush to remove older interpreter support.
Removing support for older versions should be well justified in that the
maintenance burden has become too high.

* **Python 2**. Python 2 is supported by version 2.x of this library.
While active development of the version 2.x series has ended, notable
issues being corrected may be backported to 2.x. Use "idna<3" in your
requirements file if you need this library for a Python 2 application.
Use "idna<3" in your requirements file if you need this library for
a Python 2 application. Be advised that these versions are no longer
actively developed.

* **Testing**. The library has a test suite based on each rule of the
IDNA specification, as well as tests that are provided as part of the
8 changes: 6 additions & 2 deletions idna/core.py
Original file line number Diff line number Diff line change
@@ -240,8 +240,12 @@ def check_label(label: Union[str, bytes, bytearray]) -> None:
if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']):
continue
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']):
if not valid_contextj(label, pos):
raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format(
try:
if not valid_contextj(label, pos):
raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format(
_unot(cp_value), pos+1, repr(label)))
except ValueError:
raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format(
_unot(cp_value), pos+1, repr(label)))
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']):
if not valid_contexto(label, pos):
2 changes: 1 addition & 1 deletion idna/package_data.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '3.7'
__version__ = '3.8'

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -19,21 +19,21 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: Name Service (DNS)",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
]
requires-python = ">=3.5"
requires-python = ">=3.6"
dynamic = ["version"]

[project.urls]
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -14,22 +14,22 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Internet :: Name Service (DNS)
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Utilities

[options]
python_requires = >=3.5
python_requires = >=3.6
packages=find:

[options.packages.find]
1 change: 1 addition & 0 deletions tests/test_idna.py
Original file line number Diff line number Diff line change
@@ -270,6 +270,7 @@ def test_decode(self, decode=None, skip_str=False):
self.assertRaises(idna.IDNAError, decode, b'xn--')
self.assertRaises(idna.IDNAError, decode, b'\x8d\xd2')
self.assertRaises(idna.IDNAError, decode, b'A.A.0.a.a.A.0.a.A.A.0.a.A.0A.2.a.A.A.0.a.A.0.A.a.A0.a.a.A.0.a.fB.A.A.a.A.A.B.A.A.a.A.A.B.A.A.a.A.A.0.a.A.a.a.A.A.0.a.A.0.A.a.A0.a.a.A.0.a.fB.A.A.a.A.A.B.0A.A.a.A.A.B.A.A.a.A.A.a.A.A.B.A.A.a.A.0.a.B.A.A.a.A.B.A.a.A.A.5.a.A.0.a.Ba.A.B.A.A.a.A.0.a.Xn--B.A.A.A.a')
self.assertRaises(idna.IDNAError, decode, b'xn--ukba655qaaaa14431eeaaba.c')

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion tools/idna-data
Original file line number Diff line number Diff line change
@@ -671,7 +671,7 @@ def main():
elif args.action == 'make-libdata':
make_libdata(args, ucdata)
else:
result = re.match(r'^(?i)(U\+|)(?P<cp>[0-9A-F]{4,6})$', args.action)
result = re.match(r'(?i)^(U\+|)(?P<cp>[0-9A-F]{4,6})$', args.action)
if result:
codepoint = int(result.group('cp'), 16)
diagnose_codepoint(codepoint, args, ucdata)