From 02410faeb5a81260f6bcc69f8a3217583d1dbf1e Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Sun, 21 Jun 2026 10:45:06 +0800 Subject: [PATCH 1/4] ci: upgrade actions to v6 and add py3.14 to test list --- .github/workflows/codestyle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 36e81d3..c6a855d 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From f63b6b7b65a45043a520f5c9b90f19f2d70d2809 Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Sun, 21 Jun 2026 10:50:32 +0800 Subject: [PATCH 2/4] docs: declare py3.14 supported --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 476fc0e..00511f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ classifiers=[ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] keywords = ["jinja2"] dependencies = [ From 83cb03375156a9825936f4e614fbe6907ff3f228 Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Sun, 21 Jun 2026 10:58:27 +0800 Subject: [PATCH 3/4] refactor: remove noqa in the `__init__` file --- docxtpl/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index 5559d4f..ebb72ea 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -6,11 +6,20 @@ """ __version__ = "0.20.2" +__all__ = ( + "InlineImage", + "Listing", + "RichText", + "R", + "RichTextParagraph", + "RP", + "DocxTemplate", + "Subdoc", +) -# flake8: noqa from .inline_image import InlineImage from .listing import Listing -from .richtext import RichText, R, RichTextParagraph, RP +from .richtext import RP, R, RichText, RichTextParagraph from .template import DocxTemplate try: From cebcc0a2330a3123a317568c3eca43b6d744ef89 Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Sun, 21 Jun 2026 12:12:42 +0800 Subject: [PATCH 4/4] refactor: sort import statements in docxtpl/ --- docxtpl/subdoc.py | 10 +++++----- docxtpl/template.py | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docxtpl/subdoc.py b/docxtpl/subdoc.py index e8da093..da5cfbc 100644 --- a/docxtpl/subdoc.py +++ b/docxtpl/subdoc.py @@ -5,15 +5,15 @@ @author: Eric Lapouyade """ +import re + from docx import Document -from docx.oxml import CT_SectPr from docx.opc.constants import RELATIONSHIP_TYPE as RT -from docxcompose.properties import CustomProperties -from docxcompose.utils import xpath +from docx.oxml import CT_SectPr from docxcompose.composer import Composer -from docxcompose.utils import NS +from docxcompose.properties import CustomProperties +from docxcompose.utils import NS, xpath from lxml import etree -import re class SubdocComposer(Composer): diff --git a/docxtpl/template.py b/docxtpl/template.py index f20280a..960ad7c 100644 --- a/docxtpl/template.py +++ b/docxtpl/template.py @@ -6,28 +6,29 @@ """ from __future__ import annotations -from os import PathLike -from typing import TYPE_CHECKING, Any, Optional, IO, Union, Dict, Set +import binascii import functools import io -from lxml import etree +import os +import re +import zipfile +from os import PathLike +from typing import IO, TYPE_CHECKING, Any, Dict, Optional, Set, Union + +import docx.oxml.ns from docx import Document +from docx.opc.constants import RELATIONSHIP_TYPE as REL_TYPE from docx.opc.oxml import parse_xml from docx.opc.part import XmlPart -import docx.oxml.ns -from docx.opc.constants import RELATIONSHIP_TYPE as REL_TYPE from jinja2 import Environment, Template, meta from jinja2.exceptions import TemplateError +from lxml import etree try: from html import escape # noqa: F401 except ImportError: # cgi.escape is deprecated in python 3.7 from cgi import escape # noqa: F401 -import re -import binascii -import os -import zipfile if TYPE_CHECKING: from .subdoc import Subdoc