From 7015ae3cdcf16e6c2666fa0be5ab02e4af15af43 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 7 Oct 2025 00:34:49 +0200 Subject: [PATCH 1/6] support Python 3.13 and 3.14 --- .github/workflows/ci.yml | 4 ++++ pyproject.toml | 4 +++- src/emeraldtree/html.py | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12fe688..fea5afb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,10 @@ jobs: python-version: '3.11' - os: ubuntu-latest python-version: '3.12' + - os: ubuntu-latest + python-version: '3.13' + - os: ubuntu-latest + python-version: '3.14' runs-on: ${{ matrix.os }} timeout-minutes: 10 diff --git a/pyproject.toml b/pyproject.toml index e20114c..ace6d07 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "License :: OSI Approved :: Python Software Foundation License", "Intended Audience :: Developers", "Topic :: Text Processing :: Markup :: HTML", @@ -39,7 +41,7 @@ write_to = "src/emeraldtree/_version.py" [tool.tox] legacy_tox_ini = """ [tox] -envlist = py{39,310,311,312} +envlist = py{39,310,311,312,313,314} [testenv] deps = pytest diff --git a/src/emeraldtree/html.py b/src/emeraldtree/html.py index 2d94742..21dd91e 100644 --- a/src/emeraldtree/html.py +++ b/src/emeraldtree/html.py @@ -93,9 +93,10 @@ def handle_starttag(self, tag, attrs): elif k == "content": content = v if http_equiv == "content-type" and content: - import cgi - _, params = cgi.parse_header(content) - encoding = params.get('charset') + from email.message import Message + msg = Message() + msg['content-type'] = content + encoding = msg.get_param('charset', header='content-type') if encoding: self.encoding = encoding if tag.name in self.AUTOCLOSE: From d2f9594c197fbcf918694d250aaf9395a1328237 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 7 Oct 2025 01:02:35 +0200 Subject: [PATCH 2/6] tox: use the native pyproject.toml support --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ace6d07..bbeabfb 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,11 +39,11 @@ build-backend = "setuptools.build_meta" write_to = "src/emeraldtree/_version.py" [tool.tox] -legacy_tox_ini = """ -[tox] -envlist = py{39,310,311,312,313,314} +requires = ["tox>=4"] +env_list = ["py39", "py310", "py311", "py312", "py313", "py314"] -[testenv] -deps = pytest -commands = pytest -rs --pyargs {posargs:emeraldtree} -""" +[tool.tox.env.py] +deps = ["pytest"] +commands = [ + ["pytest", "-rs", "--pyargs", "{posargs:emeraldtree}"] +] From 273e7ef1b0a00fbcb019c01db46b37d75f31799f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 18 Jan 2026 06:37:53 +0100 Subject: [PATCH 3/6] switch to spdx license identifier --- pyproject.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bbeabfb..15b092a 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,12 +18,11 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", - "License :: OSI Approved :: Python Software Foundation License", "Intended Audience :: Developers", "Topic :: Text Processing :: Markup :: HTML", "Topic :: Text Processing :: Markup :: XML", ] -license = {text="Python (MIT style)"} +license = "HPND-sell-variant" # aka "Python (MIT Style)" or "Elementtree" license [project.urls] "Homepage" = "https://github.com/moinwiki/emeraldtree" @@ -32,7 +31,7 @@ license = {text="Python (MIT style)"} where = ["src"] [build-system] -requires = ["setuptools", "wheel", "setuptools_scm[toml]"] +requires = ["setuptools>=78.1.1", "wheel", "setuptools_scm[toml]"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] From fd6cec9c686952b64b3e00a122ff9ed4c5f65b6a Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 18 Jan 2026 06:39:44 +0100 Subject: [PATCH 4/6] remove Python 3.9 support --- .github/workflows/ci.yml | 2 -- pyproject.toml | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fea5afb..1037467 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,6 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - python-version: '3.9' - os: ubuntu-latest python-version: '3.10' - os: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index 15b092a..2a37c1a 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,14 +5,13 @@ readme = "README.rst" authors = [{name="Bastian Blank", email="bblank@thinkmo.de"}, ] maintainers = [{name="Thomas Waldmann", email="tw@waldmann-edv.de"}, ] description = "EmeraldTree - a light-weight XML object model for Python." -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["xml", "html", "html5", "polyglot", "element", "tree", "dom", "unicode"] classifiers = [ "Development Status :: 4 - Beta", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -39,7 +38,7 @@ write_to = "src/emeraldtree/_version.py" [tool.tox] requires = ["tox>=4"] -env_list = ["py39", "py310", "py311", "py312", "py313", "py314"] +env_list = ["py310", "py311", "py312", "py313", "py314"] [tool.tox.env.py] deps = ["pytest"] From 4934e7b76d9c1906729b1470005509c2d3ec2f6d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 18 Jan 2026 06:45:56 +0100 Subject: [PATCH 5/6] update CHANGES --- CHANGES.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 3b5abe0..97ed7fa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,16 @@ Change Log ========== +Version 0.12.0 (not released yet) +--------------------------------- + +Other changes: + +- support Python 3.13 and 3.14, drop support for Python 3.9 +- switch to SPDX license identifier +- use native ``pyproject.toml`` support in tox +- add scripts for sdist, signing, and PyPI upload + Version 0.11.0 (2024-04-05) --------------------------- From b6fe956cb0beaa6d0bb5a1ad9eee9ad77ff2ee6d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 18 Jan 2026 06:48:13 +0100 Subject: [PATCH 6/6] CHANGES: fix typos and grammar --- CHANGES.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 97ed7fa..4be64ef 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,20 +16,20 @@ Version 0.11.0 (2024-04-05) Fixes: -- html parser: fix extraction of encoding from meta element +- HTML parser: fix extraction of encoding from meta element - use raw string for regex, fixes "DeprecationWarning: invalid escape sequence \s" and others. New features: -- include version infos into emeraldtree.__init__ +- include version info into emeraldtree.__init__ Other changes: - packaging modernized / enhanced: pyproject.toml, MANIFEST.in, setuptools-scm - requires Python >= 3.9 now (dropped Python 2.x, removed "six") -- add github actions CI, remove travis CI config -- rst markup fixes / clean ups +- add GitHub Actions CI, remove Travis CI config +- rst markup fixes / cleanups - use tox for testing Version 0.10.0 (2015-06-10) @@ -38,7 +38,7 @@ Version 0.10.0 (2015-06-10) Fixes: - fix setup.py - platform and no download_url -- invalid output from HTML converter parsing preformatted code, multiline +- fix invalid output from HTML converter parsing preformatted code, multiline paragraphs: part 2 of 2 fixes moin2 #516 Other changes: