A Python SDK for advanced creation and manipulation of Microsoft Word .docx files.
Overview
python-docx-oss is an independently evolving DOCX SDK built on the proven API
foundation of python-docx. It keeps
the familiar docx programming model while extending it for advanced OOXML and Open
Packaging Convention (OPC) workflows.
Use it when an application needs more than basic paragraphs and tables: custom document metadata, application-owned XML, vector images, floating pictures, East Asian fonts, package inspection, configurable fingerprints, repair, or low-level package and relationship access.
Documentation · API Reference · Release History
Capability Matrix
| Capability | Primary API / Behavior |
|---|---|
| Major additions | |
| Custom document properties | document.custom_properties |
| Custom XML lifecycle | add_custom_xml_part(), delete_custom_xml_part() |
| SVG and EMF images | add_picture() |
| Floating pictures | add_float_picture() |
| Latin and East Asian font controls | run.font.name, run.font.hAnsi, run.font.eastAsia |
| Low-level OPC parts and relationships | document.part.package, part.rels |
| In-memory read, export, and independent copies | Document(bytes), to_bytes(), copy() |
| Document sanitization | document.sanitize() |
| Read-only package inspection and streaming feature scanning | inspect(), ScanEvent |
| Configurable package-content fingerprints | fingerprint(), FingerprintPolicy, serialize_xml |
| Explicit empty Custom XML repair and hyperlink normalization | repair(), normalize() |
| Major fixes and compatibility | |
| Strict Open XML compatibility | Open Strict documents through Document() with transparent package normalization |
| Table width and logical layout compatibility | Read measurement and percentage widths, logical indentation, and start / end alignment |
| lxml text extraction | Prevent duplicate itertext() output; preserve public .text APIs |
Installation
python -m pip install python-docx-oss
The distribution name is python-docx-oss, but the Python import namespace remains
docx:
from docx import Document
Quick Start
Prepare a sharing copy with custom metadata, East Asian fonts, and a content fingerprint:
from docx import Document, fingerprint
internal = Document("internal-report.docx")
public = internal.copy() # Keep the original unchanged.
public.custom_properties["distribution"] = "public" # Set document metadata.
public.part.add_custom_xml_part('<report xmlns="urn:example:reports" id="Q4"/>')
public.add_paragraph().add_run("中文内容").font.eastAsia = "Microsoft YaHei"
public.sanitize(personal_metadata=True, comments=True) # Remove private info.
content = public.to_bytes() # Export without temporary files.
digest = fingerprint(content) # Compute a normalized package-content fingerprint.
Compatibility and Scope
- The project maintains broad compatibility with the public
python-docxAPI while following its own versioning and product roadmap. - Compatibility does not extend to every private or internal
python-docxAPI. Test those integrations before migrating production systems. - The SDK focuses exclusively on DOCX. It is not a general XLSX/PPTX Office suite.
- It edits document structure but does not implement Word's page-layout rendering engine.
- CLI, MCP, web, desktop, and Agent runtimes belong in separate packages that consume this SDK.
Why “OSS”?
In Brazilian jiu-jitsu, “oss” is a greeting and an expression of respect. It reflects the same spirit of discipline and collaboration behind this project.
Support
If this project is useful to you, you can support its continued development through the donation page.
Metadata
Release files for python-docx-oss 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_docx_oss-0.5.2.tar.gz | 8.9 MB | With provenance | Details for python_docx_oss-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_docx_oss-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for python_docx_oss-0.5.2-py3-none-any.whl |
Total release size: 9.2 MB
Release files / python_docx_oss-0.5.2.tar.gz
| Download URL | python_docx_oss-0.5.2.tar.gz |
|---|---|
| Size | 8.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3f9284ba9210addc45ad681c0952c379eab59324b8aba46fef93dcd12e69fbf
|
|
BLAKE2b-256 checksum How to use checksums |
7111fafc72871e19dcdb1f684c0e28b89cba767fb4a64e18c9a2fe58ad21a4fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / python_docx_oss-0.5.2-py3-none-any.whl
| Download URL | python_docx_oss-0.5.2-py3-none-any.whl |
|---|---|
| Size | 299.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a209b60000b5e51e6e4cfb71b96a222b327cb18d847093068bca73575e2518b1
|
|
BLAKE2b-256 checksum How to use checksums |
5bad3758b706d5c88b76c8a980e28bf351d59a33a7ad289c5c910aa85b370949
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for python-docx-oss 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for python_docx_oss-0.5.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.