Skip to main content

docx-fresh

Give python-docx documents fresh metadata instead of the default template's.

docx.Document() without a template copies the document properties of python-docx's bundled default.docx. Every new file says it was written in 2013 by "python-docx" in Word for Mac, and Windows Explorer and Word's File > Info show it:

Property Without docx-fresh With docx-fresh
Author python-docx empty, or the name you pass
Last modified by empty same as author
Comments generated by python-docx empty
Created / Modified 2013-12-23 23:15 UTC now
Application (app.xml) Microsoft Macintosh Word 14.0 not set
Pages, words, lines (app.xml) 1 page, 0 words not set
Thumbnail the template's none

Install

pip install docx-fresh

Use

import docx
from docx_fresh import fresh

document = fresh(docx.Document(), author="Report bot")
document.add_heading("Weekly report", 1)
document.save("report.docx")

fresh() changes only values that still equal the default template's. A document made from your own template keeps its author, dates, app.xml and thumbnail, so it is safe to call on every document.

Options:

  • author: written to Author and Last modified by. Default "".
  • now: timezone-aware time for Created and Modified. Default: the current UTC time.

The page, word and line counts are removed rather than recomputed: only the application that lays the document out can count pages, and Word fills them in on its next save.

Fix existing files

docx-fresh report.docx                  # in place
docx-fresh report.docx -o fixed.docx    # to a new file
docx-fresh report.docx --author "Report bot"

Why not fixed in python-docx?

python-docx already sets Modified to now when a package has no document properties at all, but default.docx has them, so that code never runs. Until it is fixed upstream, fresh() is one line.

Development

python -m venv .venv
.venv/Scripts/pip install -e ".[test]"     # or .venv/bin/pip on macOS and Linux
.venv/Scripts/python -m pytest

License

MIT

Metadata

Release files for docx-fresh 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docx-fresh 0.1.0
File Size Uploaded Provenance Actions
docx_fresh-0.1.0.tar.gz 6.0 kB With provenance Details for docx_fresh-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docx-fresh 0.1.0
File Interpreter ABI Platform Actions
docx_fresh-0.1.0-py3-none-any.whl Python 3 none any Details for docx_fresh-0.1.0-py3-none-any.whl

Total release size: 11.6 kB

Release files / docx_fresh-0.1.0.tar.gz

Download URL docx_fresh-0.1.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dcfc6b1c6d99d1a19d69fb231bcbe090c593e1e95bee97d5d07638f276963f15
BLAKE2b-256 checksum
How to use checksums
407562f586737657f6232694a62238f41f9ec0d717744f3687db779a0b5d28be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / docx_fresh-0.1.0-py3-none-any.whl

Download URL docx_fresh-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bae9d39b554944e6d2243ec5c57f1bc90b3cabe8f856bd632d194f727780ad99
BLAKE2b-256 checksum
How to use checksums
ac0abb5ffa92f14b078515bde36f7f2d59b1505182a94767be438e7419693b60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Security for docx-fresh 0.1.0

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.

Select from 2 files

Attestation for docx_fresh-0.1.0.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 24, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page