From 5499748cb026fa5009659d812f4f4251195614e0 Mon Sep 17 00:00:00 2001 From: Pierpaolo Da Fieno Date: Wed, 9 Jul 2025 16:30:28 +0200 Subject: [PATCH 1/6] Fixed DeprecationWarning on pkg_import. --- docxcompose/properties.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docxcompose/properties.py b/docxcompose/properties.py index aa8cd2d..bd7b439 100644 --- a/docxcompose/properties.py +++ b/docxcompose/properties.py @@ -15,7 +15,8 @@ from lxml.etree import QName from six import binary_type from six import text_type -import pkg_resources +#import pkg_resources +import importlib_resources import re @@ -108,8 +109,10 @@ def __init__(self, doc): self._element = parse_xml(part.blob) def _part_template(self): - return pkg_resources.resource_string( - 'docxcompose', 'templates/custom.xml') + # return pkg_resources.resource_string( + # 'docxcompose', 'templates/custom.xml') + ref = importlib_resources.files('docxcompose').joinpath('templates/custom.xml') + return ref.read_bytes() def _update_part(self): if self.part is None: From 8bdf3f1df72c9f566c39a16be650c78c9df00b34 Mon Sep 17 00:00:00 2001 From: Pierpaolo Da Fieno Date: Thu, 24 Jul 2025 18:28:14 +0200 Subject: [PATCH 2/6] Update properties.py Removed old lines of code Changed import of importlib.resources --- docxcompose/properties.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docxcompose/properties.py b/docxcompose/properties.py index bd7b439..51f2ac0 100644 --- a/docxcompose/properties.py +++ b/docxcompose/properties.py @@ -15,8 +15,7 @@ from lxml.etree import QName from six import binary_type from six import text_type -#import pkg_resources -import importlib_resources +import importlib.resources as importlib_resources import re @@ -109,8 +108,6 @@ def __init__(self, doc): self._element = parse_xml(part.blob) def _part_template(self): - # return pkg_resources.resource_string( - # 'docxcompose', 'templates/custom.xml') ref = importlib_resources.files('docxcompose').joinpath('templates/custom.xml') return ref.read_bytes() From af8309556f83aabc96ef5f441611e9e3a0977ca9 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Aug 2025 18:58:48 -0400 Subject: [PATCH 3/6] Bump fork version --- README.rst | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6ba0d20..67a03a8 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,8 @@ *docxcompose* is a Python library for concatenating/appending Microsoft Word (.docx) files. +This fork add the PR 112, Fixed DeprecationWarning on pkg_import, by @numshub + Example usage ------------- diff --git a/setup.py b/setup.py index 1d7d53c..b8f9ae6 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='docxcompose', - version='1.4.1.dev0', + version='1.4.1.emmv', description="Compose .docx documents", long_description=(open("README.rst").read() + "\n" + open("HISTORY.txt").read()), From c7069003d5f1de20e0ad3c8ceabf609631a9aec3 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Aug 2025 19:02:50 -0400 Subject: [PATCH 4/6] Fix version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b8f9ae6..4081c03 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='docxcompose', - version='1.4.1.emmv', + version='1.4.1.post0+emmv', description="Compose .docx documents", long_description=(open("README.rst").read() + "\n" + open("HISTORY.txt").read()), From 8bf54e5dd57a639e9dd2e8940a57203e6b19ac58 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Aug 2025 19:25:12 -0400 Subject: [PATCH 5/6] Migrated build system to PEP 517/621. --- HISTORY.txt | 8 ++++++++ pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 50 --------------------------------------------- 3 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/HISTORY.txt b/HISTORY.txt index 87aea06..99226a3 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -1,6 +1,14 @@ Changelog ========= +1.4.1.post0+emmv +------------------ + +- Migrated build system to PEP 517/621. +- Added pyproject.toml with modern metadata. +- Declared dynamic readme using setuptools to combine README.rst and HISTORY.txt. +- Removed legacy setup.py-based build path to avoid deprecation warnings. + 1.4.1 (unreleased) ------------------ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..99487ee --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["setuptools>=68", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "docxcompose" +version = "1.4.1.post0+emmv" # PEP 440-valid +description = "Compose .docx documents" +requires-python = ">=3.8" +license = { text = "MIT License" } + +authors = [ + { name = "Thomas Buchberger", email = "t.buchberger@4teamwork.ch" }, +] +maintainers = [ + { name = "Emmanuel Viennet" } +] + +keywords = ["Python", "DOCX", "Word", "OOXML"] + +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "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", +] + +dependencies = [ + "lxml", + "python-docx>=0.8.8", + "six", + "Babel", # (same as 'babel'; keep if upstream uses it) +] + +[project.optional-dependencies] +test = ["pytest"] + +[project.scripts] +docxcompose = "docxcompose.command:main" + +[project.urls] +Homepage = "https://github.com/emmanuelito/docxcompose" +Repository = "https://github.com/emmanuelito/docxcompose" + + +# declare readme dynamically via setuptools +[tool.setuptools.dynamic] +readme = { file = ["README.rst", "HISTORY.txt"], content-type = "text/x-rst" } diff --git a/setup.py b/setup.py deleted file mode 100644 index 4081c03..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -"""Installer for the docxcompose package.""" - -from setuptools import find_packages -from setuptools import setup - - -tests_require = [ - 'pytest', -] - -setup( - name='docxcompose', - version='1.4.1.post0+emmv', - description="Compose .docx documents", - long_description=(open("README.rst").read() + "\n" + - open("HISTORY.txt").read()), - # Get more from https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - "License :: OSI Approved :: MIT License", - ], - keywords='Python DOCX Word OOXML', - author='Thomas Buchberger', - author_email='t.buchberger@4teamwork.ch', - url='https://github.com/4teamwork/docxcompose', - license='MIT license', - packages=find_packages(exclude=['ez_setup']), - include_package_data=True, - zip_safe=True, - install_requires=[ - 'lxml', - 'python-docx >= 0.8.8', - 'setuptools', - 'six', - 'babel', - ], - extras_require={ - 'test': tests_require, - 'tests': tests_require, - }, - entry_points={ - 'console_scripts': [ - 'docxcompose = docxcompose.command:main' - ] - }, -) From ee78aa431abd3d9f8384ad43763a916bc70e63ce Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Aug 2025 19:33:04 -0400 Subject: [PATCH 6/6] README --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 67a03a8..71a5da4 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,9 @@ *docxcompose* is a Python library for concatenating/appending Microsoft Word (.docx) files. -This fork add the PR 112, Fixed DeprecationWarning on pkg_import, by @numshub +This fork adds the PR 112, Fixed DeprecationWarning on pkg_import, by +@numshub +and modernizes the build system for Python >= 3.8. Example usage