Skip to main content

onenote-tool

A Python library and CLI for parsing and converting Microsoft OneNote .onepkg (notebook export) and .one (section) files — including best-effort content recovery for password-protected sections, which Microsoft's own tooling doesn't expose.

This is not an official Microsoft project, and it is lossy by design: OneNote's binary format ([MS-ONESTORE]) is large, partly undocumented, and this tool reads what it can, reports what it can't, and never claims perfect fidelity. See Documentation.md for exactly what's currently supported.

What it's for

  • Pulling text, images, tables, hyperlinks, ink/drawings, and embedded files out of a .onepkg export into a neutral, semantic HTML-per-block format your own code can render however it likes.
  • Recovering as much as possible from a password-protected section, given the password — OneNote's own export/print tools generally refuse to touch protected content at all.
  • A quick command-line tool for poking at a notebook's structure while developing against it (onenote-tool inspect), without writing a script each time.

It is explicitly not trying to be a pixel-perfect OneNote renderer — the output is deliberately generic (see "The blocks format" in Documentation.md) so that a consuming application does its own layout/styling, rather than this library making that decision for everyone.

Install

pip install onenote-tool          # library only
pip install onenote-tool[cli]     # + the `onenote-tool` command-line tool

(Not yet published to PyPI — see docs/knowledge/known-limitations.md for current status. For now, install from a local clone: pip install -e ".[cli,dev]".)

Platform note: unpacking a .onepkg (a CAB archive) uses Windows' expand.exe when present, otherwise falls back to the cabextract CLI (install via apt/brew/dnf) on Linux/macOS. Run onenote-tool doctor to check which one it found. See docs/knowledge/known-limitations.md.

Quick start — CLI

onenote-tool convert MyNotebook.onepkg --dump-dir ./out
onenote-tool convert MyNotebook.onepkg --section-password "My Section"=hunter2
onenote-tool inspect SomeSection.one --password hunter2
onenote-tool doctor

Quick start — Python API

from onenote_tool import convert_onepkg

result = convert_onepkg("MyNotebook.onepkg", section_passwords={"My Section": "hunter2"})

print(result.notebook_name, result.page_count)
for section in result.sections:
    print(section.name, section.password_status)
    for page in section.pages:
        print(" ", page.title, [b["kind"] for b in page.blocks])

See Documentation.md for the full API/CLI reference, the blocks format contract, how passwords are handled, and the progress-reporting flow for a caller that wants to show live conversion progress (e.g. a web backend importing a large notebook).

Learning how this works

If you're picking up development on this project, start with docs/knowledge/ — it has everything that was reverse engineered to make this possible (the file format, the encryption scheme, and a chronological log of what was tried and what actually worked), so you don't have to re-derive it.

License

MIT — see LICENSE.

Metadata

Release files for onenote-tool 0.1.1

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

Source distribution (sdist)

Source distribution for onenote-tool 0.1.1
File Size Uploaded Provenance Actions
onenote_tool-0.1.1.tar.gz 85.6 kB With provenance Details for onenote_tool-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for onenote-tool 0.1.1
File Interpreter ABI Platform Actions
onenote_tool-0.1.1-py3-none-any.whl Python 3 none any Details for onenote_tool-0.1.1-py3-none-any.whl

Total release size: 154.1 kB

Release files / onenote_tool-0.1.1.tar.gz

Download URL onenote_tool-0.1.1.tar.gz
Size 85.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6a8ffab864a85261db3443240db96828c53d9f4a3d2d107eb593e502c68a1ba7
BLAKE2b-256 checksum
How to use checksums
95351d09bbbcc61b39a78c581c1dc61819c6a89060425c04ec09f43cc9c5880d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Release files / onenote_tool-0.1.1-py3-none-any.whl

Download URL onenote_tool-0.1.1-py3-none-any.whl
Size 68.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a5a5a3416d2025764f67db261bd80557c459f7ae6b2d46e53d0ecf32367b4d1
BLAKE2b-256 checksum
How to use checksums
487817492d9cc6f5dbbcd5ec2d6e3519bcc340bc40be43e67adda8aa3a0531ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Security for onenote-tool 0.1.1

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 onenote_tool-0.1.1.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 Aug 10, 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.

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