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/README.rst b/README.rst index 6ba0d20..71a5da4 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,10 @@ *docxcompose* is a Python library for concatenating/appending Microsoft Word (.docx) files. +This fork adds the PR 112, Fixed DeprecationWarning on pkg_import, by +@numshub +and modernizes the build system for Python >= 3.8. + Example usage ------------- diff --git a/docxcompose/properties.py b/docxcompose/properties.py index aa8cd2d..51f2ac0 100644 --- a/docxcompose/properties.py +++ b/docxcompose/properties.py @@ -15,7 +15,7 @@ from lxml.etree import QName from six import binary_type from six import text_type -import pkg_resources +import importlib.resources as importlib_resources import re @@ -108,8 +108,8 @@ 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() def _update_part(self): if self.part is None: 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 1d7d53c..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.dev0', - 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' - ] - }, -)