Skip to content

Deprecation warning: pkg_resources will be removed from setuptools in 2025 #605

Open

Description

@lhe127

I am using the docxcompose library, and I have encountered the following deprecation warning related to pkg_resources:

UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources

This warning informs us that pkg_resources will be removed from setuptools after November 2025. As this library depends on pkg_resources, this could cause compatibility issues with future versions of Python and setuptools.

Activity

  1. waketzheng commented on Jul 22, 2025

    @waketzheng
    Contributor
  2. waketzheng commented on Jul 22, 2025

    @waketzheng
    Contributor

    Last commit of docxcompose is 3 years ago, I think it is time to remove this line

    from .subdoc import Subdoc
    

    from docxtpl/__init__.py, and move docxcompose to optional dependencies.

  3. svleeuwen commented on Sep 22, 2025

    @svleeuwen

    I would also really like to see docxcompose moved to optional dependencies.

    Perhaps we can extract this to a separate PR so it's easier to merge?

    Another argument for this is that docxcompose hasn't published any wheels (causing issues when installing manylinux reqs).

  4. waketzheng commented on Sep 23, 2025

    @waketzheng
    Contributor
  5. jackspiece commented on Jul 30, 2026

    @jackspiece

    I rechecked this against the current upstream releases. The original pkg_resources problem is resolved now.

    I also tested the current python-docx-template master subdocument path under -W error:

    • CPython 3.8.20 with docxcompose 1.4.1 and no setuptools package installed
    • CPython 3.12.13 with docxcompose 2.2.0

    In both environments, importing CustomProperties, loading its XML template, and creating a subdocument with new_subdoc() passed. This issue can be closed as resolved upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions