You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docxcompose is not longer installed as dependency in version 0.20.2 #629
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# -*- coding: utf-8 -*-
"""
Created : 2021-07-30
@author: Eric Lapouyade
"""
from docx import Document
from docx.oxml import CT_SectPr
from docx.opc.constants import RELATIONSHIP_TYPE as RT
> from docxcompose.properties import CustomProperties
E ModuleNotFoundError: No module named 'docxcompose'
Our requirements.txt file refers to docxtpl like
docxtpl~=0.20.0
Our code worked for version 0.20.1 and is broken for 0.20.2
Actually I think such a refactoring should not be part of a patch release but should at least have been part of a minor release. We pinned the version to be protected against such breaking changes.
I reproduced this from a clean Python 3.14 virtual environment with the current project installed from source and only its mandatory dependencies (python-docx, jinja2, and lxml). docxcompose was absent and DocxTemplate(...).new_subdoc() raised ModuleNotFoundError: No module named 'docxcompose' while importing docxtpl.subdoc.
The dependency is correctly declared as the optional subdoc extra. Would a small guard in new_subdoc() be acceptable? It could raise a clear error such as:
new_subdoc() requires the optional docxcompose dependency. Install it with: pip install docxtpl[subdoc]
I would keep docxcompose optional and add a focused test that simulates its absence. If this direction is acceptable, I can prepare that minimal PR.
Activity
janmarsino98 commentedon Jul 14, 2026
I reproduced this from a clean Python 3.14 virtual environment with the current project installed from source and only its mandatory dependencies (
python-docx,jinja2, andlxml).docxcomposewas absent andDocxTemplate(...).new_subdoc()raisedModuleNotFoundError: No module named 'docxcompose'while importingdocxtpl.subdoc.The dependency is correctly declared as the optional
subdocextra. Would a small guard innew_subdoc()be acceptable? It could raise a clear error such as:I would keep
docxcomposeoptional and add a focused test that simulates its absence. If this direction is acceptable, I can prepare that minimal PR.