docx
The docx module creates, reads and writes Microsoft Office Word 2007 docx files
What it is and what it does
The docx module is a pure-Python library for creating, reading, and editing Microsoft Word 2007 docx files without requiring Office or COM automation. It can generate documents with paragraphs, bullets, numbered lists, headings, tables, page breaks, and images, and can parse existing docx files to extract text, search and replace content, and run XPath queries on document structure.
The project was last updated in 2014 and is now archived. While it has moderate download volume, its abandonment means no bug fixes, security updates, or compatibility improvements for modern Python versions. The install friction is high due to tarball-only distribution and external dependencies (lxml, PIL). Use only if you need legacy docx support in an older codebase; for new projects, consider actively maintained alternatives.
Use it for:
- Generate Word documents programmatically from Python scripts or web applications without Office installed.
- Extract plain text from existing docx files for indexing, analysis, or migration to other formats.
- Automate document creation with dynamic content like reports, invoices, or mail-merge templates.
- Parse user-completed Word document templates using XPath queries to extract structured data.
- Modify existing docx files by adding, deleting, or replacing content at specific locations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Creates, reads, and writes Microsoft Office Word 2007 docx files in pure Python without requiring Office, COM automation, or external tools.
No. The package is abandoned (last update 2014, archived repository), has high install friction (tarball only, external build dependencies), and offers no Python version guarantee for modern environments. For new projects, use python-docx (the actively maintained fork) or another current library. Only consider this version if you have legacy code already depending on it and cannot migrate.
Install
docx on PyPI
pip
pip install docxuv
uv add docxpoetry
poetry add docxInstalling docx
Before you install
High install friction: the package distribution is a bare tarball with no wheel, and the project has been abandoned since 2015 with no maintenance activity for many years. Dependency on lxml and PIL adds system-level build requirements.
License in practice
License treatment is unclear; the description mentions MIT licensing but the metadata shows 'UNKNOWN'. Verify the actual license terms before relying on this package in a commercial or copyleft-sensitive context.
Quickstart
pip install docx
from docx import Document
doc = Document()
doc.add_paragraph('Hello, World!')
doc.save('output.docx')
Requires lxml and PIL (Pillow) system dependencies; no Python version constraint specified in metadata, so compatibility with modern Python versions is unverified.
Verify before relying
- Actual Python version compatibility—metadata specifies no minimum or maximum, and the project has not been updated since 2015.
- Whether lxml and PIL are truly required at runtime or only for certain features (image handling).
- Current state of the MIT license claim given the 'UNKNOWN' metadata tag.
Package facts
| License | UNKNOWN (unclear) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,572 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 381,350/month — #7,096 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docx-0.2.4.tar.gz
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
docxtplGenerates Word documents (.docx) from templates…
copyleft · top 5,000 on PyPI
python-didl-liteReads and writes DIDL-Lite XML documents, a…
permissive · top 15,000 on PyPI
python-docxpython-docx reads, creates, and modifies…
permissive · top 1,000 on PyPI
python-docx-ml6Reads, creates, and updates Microsoft Word…
permissive · top 15,000 on PyPI
python-hwpxReads, edits, and creates HWPX documents…
permissive · top 15,000 on PyPI
docxcomposeConcatenates and merges multiple Microsoft Word…
permissive · top 5,000 on PyPI
docx2pythonExtracts text, images, headers, footers,…
permissive · top 15,000 on PyPI
pyhwpxAutomates HWP (아래아한글) document creation and…
unclear · top 15,000 on PyPI
htmldocxConverts HTML content into Microsoft Word…
permissive · top 5,000 on PyPI