odfpy
Python API and tools to manipulate OpenDocument files
What it is and what it does
Odfpy is a Python library for reading and writing OpenDocument Format (ODF) files—the standard format used by LibreOffice, OpenOffice, and other office suites. It provides a complete API generated from the ODF RelaxNG schema and hand-edited to cover all valid ODF constructions. The library enforces document validity at the API level, raising exceptions when you attempt invalid operations such as adding unknown attributes, omitting required fields, or placing text in elements that forbid it.
Beyond the core API, odfpy includes command-line tools for common tasks: converting CSV to ODF spreadsheets, transforming ODF documents to HTML or XHTML, extracting and modifying metadata, validating ODF files, and converting between ODF and XML representations. It has no external runtime dependencies, making it lightweight to deploy, though installation friction is high and the package has not seen a release since 2020-01-18 despite active repository commits.
Use it for:
- Generate ODF spreadsheets or text documents programmatically with built-in validation to catch structural errors before saving.
- Convert CSV data into OpenDocument spreadsheet files using the csv2odf command-line tool.
- Transform ODF documents to HTML or XHTML for web viewing or archival using odf2xhtml or odf2mht.
- Inspect and modify ODF file metadata without opening the document in an office application.
- Validate ODF files for structural correctness and report problems using the odflint tool.
- Extract or manipulate user-defined fields in ODF documents via the odfuserfield command.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Odfpy reads and writes OpenDocument v. 1.2 files with validation to prevent invalid document construction, enforcing grammar rules, required attributes, and element content constraints.
Yes, with conditions. Odfpy is stable, actively maintained at the repository level, and has no known vulnerabilities. It is suitable for production use if your target Python version falls within the documented range (2.7, 3.4–3.7) or you verify compatibility with newer versions. The high install friction and gap since the last release (2020-01-18) suggest caution: test thoroughly in your environment, and verify that the unclear license terms (Apache, GPL, LGPL) align with your project's requirements.
Install
odfpy on PyPI
pip
pip install odfpyuv
uv add odfpypoetry
poetry add odfpyInstalling odfpy
Before you install
Install friction is high; the package has no runtime dependencies but distribution artifacts suggest build complexity. Maintenance is active with recent commits (2026-04-07), though the latest release dates to 2020-01-18, leaving a gap between release and current repository state.
License in practice
License treatment is unclear: the package declares Apache, GPL, and LGPL in its classifiers but provides no explicit license text or SPDX identifier in metadata. Users should verify the actual license terms before adopting.
Quickstart
pip install odfpy
import odfpy
# Create and manipulate OpenDocument files programmatically
# See https://github.com/eea/odfpy/wiki for documentation and examples
Classifiers indicate support for Python 2.7 and 3.4–3.7; compatibility with modern Python versions is unspecified. Verify compatibility with your target Python version before use.
Verify before relying
- Whether the package works reliably on Python versions beyond 3.7 (classifiers end at 3.7; last release was 2020-01-18)
- Current state of the command-line tools (csv2odf, odf2xhtml, odflint, etc.) and whether they are fully functional
- Whether high install friction reflects missing build dependencies or outdated packaging
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | actively maintained — 2,400 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,332,065/month — #2,327 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: odfpy-1.4.1-py2.7.egg; odfpy-1.4.1.tar.gz
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
odfdoodfdo is a Python library for creating,…
permissive · top 15,000 on PyPI
ezodfezodf creates, opens, and modifies OpenDocument…
permissive · top 15,000 on PyPI
pyexcel-ezodfCreate, open, and modify OpenDocument Format…
permissive · top 15,000 on PyPI
docxCreates, reads, and writes Microsoft Office…
unclear · top 15,000 on PyPI
pyexcel-ods3Reads, manipulates, and writes data in ODS…
permissive · top 15,000 on PyPI
doclingDocling parses diverse document formats—PDF,…
permissive · top 5,000 on PyPI
python-calamineReads Excel and ODF spreadsheet files via a…
permissive · top 5,000 on PyPI
py3o.templateMerges data into LibreOffice/OpenOffice…
permissive · top 15,000 on PyPI
xmlformatterFormats and compresses XML documents by…
permissive · top 15,000 on PyPI
dicttoxmlConverts Python dictionaries and other native…
copyleft · top 5,000 on PyPI