Skip to main content

ozaru

Read PDF files from Python with a small, simple API and a Rust core.

PyPI version Python versions CI License: MIT

Documentation: https://jair-dev57.github.io/ozaru/

import ozaru

text = ozaru.extract_text("invoice.pdf")
pages = ozaru.page_count("invoice.pdf")

print(f"{pages} pages")
print(text)

Why ozaru?

  • One line per task. Pass a path and get the result. There are no objects to manage.
  • Easy to install. Prebuilt wheels mean you don't need Rust or a compiler.
  • No Python dependencies. ozaru installs nothing else into your environment.
  • Built on Rust. The PDF work is done by pdf_oxide.
  • Typed. Type hints are included, so your editor can autocomplete and check your calls.

Installation

pip install ozaru

Or, with uv:

uv add ozaru

ozaru requires Python 3.10 or newer.

Usage

Extract text

extract_text returns the text of the whole document as a single string:

import ozaru

text = ozaru.extract_text("report.pdf")

Count pages

page_count returns the number of pages as an integer:

import ozaru

pages = ozaru.page_count("report.pdf")

Handle errors

import ozaru

try:
    text = ozaru.extract_text("report.pdf")
except FileNotFoundError:
    print("The file does not exist.")
except OSError:
    print("The file could not be read.")
except ValueError:
    print("The file could not be read as a PDF.")

Damaged pages

If a page can't be read, extract_text still returns the other pages, leaves that page empty and emits an ozaru.PageWarning with its page number:

import warnings

import ozaru

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always", ozaru.PageWarning)
    text = ozaru.extract_text("report.pdf")

for warning in caught:
    print(f"Page {warning.message.page} could not be read")

API

Function Returns Raises Warns
extract_text(path) str OSError, ValueError PageWarning
page_count(path) int OSError, ValueError

File problems raise the same OSError subclasses as Python's open(), such as FileNotFoundError, PermissionError and IsADirectoryError.

path can be a str or a pathlib.Path.

Supported platforms

Prebuilt wheels are available for CPython 3.10 and newer:

Operating system Architectures
Linux (glibc) x86_64, aarch64
Linux (musl) x86_64, aarch64
macOS Intel, Apple Silicon
Windows x64

Before each release, the tests run against the wheels of glibc Linux, macOS and Windows on their own platform, with Python 3.10 and 3.14.

On other platforms, pip builds ozaru from source, which requires a Rust toolchain.

Limitations

ozaru is in early development, so its API may change between releases.

  • It reads the text stored in a PDF and does not perform OCR, so scanned documents may return little or no text.
  • It can't extract text from PDFs that need a password to open.

Contributing

You need Rust and uv. Then run:

git clone https://github.com/Jair-dev57/ozaru.git
cd ozaru
uv run pytest

See the contributing guide. Bug reports and ideas are welcome in the issue tracker.

License

ozaru is released under the MIT License.

Metadata

Release files for ozaru 0.1.7

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

Source distribution (sdist)

Source distribution for ozaru 0.1.7
File Size Uploaded Provenance Actions
ozaru-0.1.7.tar.gz 101.0 kB Without provenance Details for ozaru-0.1.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ozaru 0.1.7
File Actions
ozaru-0.1.7-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for ozaru-0.1.7-cp310-abi3-win_amd64.whl
ozaru-0.1.7-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for ozaru-0.1.7-cp310-abi3-musllinux_1_2_x86_64.whl
ozaru-0.1.7-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for ozaru-0.1.7-cp310-abi3-musllinux_1_2_aarch64.whl
ozaru-0.1.7-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for ozaru-0.1.7-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
ozaru-0.1.7-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for ozaru-0.1.7-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
ozaru-0.1.7-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for ozaru-0.1.7-cp310-abi3-macosx_11_0_arm64.whl
ozaru-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for ozaru-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 59.3 MB

Release files / ozaru-0.1.7.tar.gz

Download URL ozaru-0.1.7.tar.gz
Size 101.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8c664a7a580e27a88c3ba5af8dd02f06c2a3bf4e985a9251f7193759c14648c2
BLAKE2b-256 checksum
How to use checksums
c71d22b16fe37e2a685a33932c73e23446b6bf7447203180bdd1d3ef458c1ed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-win_amd64.whl

Download URL ozaru-0.1.7-cp310-abi3-win_amd64.whl
Size 7.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f5cc80623e8d47d20b708baebdddaa272acc0e91c93edf4401627f8886fed51f
BLAKE2b-256 checksum
How to use checksums
1af61951742c6c47379ddad09a5216eb1b6964f7eb80ecd6979a0263c433240c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL ozaru-0.1.7-cp310-abi3-musllinux_1_2_x86_64.whl
Size 9.1 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
0202ede5146ff4fb0de3c49cdb5bfe6a024122044a1a934cebf3c4f71b6c6a18
BLAKE2b-256 checksum
How to use checksums
4d70f3781eca03665a42baf81ded5013479dc0ba72a641bdb296318b920f7157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL ozaru-0.1.7-cp310-abi3-musllinux_1_2_aarch64.whl
Size 8.7 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
bf01d1368399dfd7046f37ce10f25c10b434516d595875f5009dc99401c3306c
BLAKE2b-256 checksum
How to use checksums
7c85d2bc94a7f6f2a4f432743583cc5a867f7dd5d7189f8bbbf161f9f3bc34a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ozaru-0.1.7-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8106d437211e969b0b1ab542c5e3bce99213adc9f3728f134ae4739f320af0c0
BLAKE2b-256 checksum
How to use checksums
c8c907802a37779a91059d483498a3449080f005bd7db4fd2a673819d39cd74a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ozaru-0.1.7-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 8.6 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
216d77de1a58f23110f9052af9b1fd59889d6c0045f4ae481a96136c5af92b2b
BLAKE2b-256 checksum
How to use checksums
7d5d137ff07e22598638df041e138f21cf1bd0541d7651b0c15abb4323edae3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-macosx_11_0_arm64.whl

Download URL ozaru-0.1.7-cp310-abi3-macosx_11_0_arm64.whl
Size 7.9 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9a28fe2c93a79a13a159477ba0f667927ed8bb58fd739b2f9e25d50dc5af1dad
BLAKE2b-256 checksum
How to use checksums
4040fa952306e1ad665720dcffc33718c25c006516f1c51fc2f28243e4de9192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ozaru-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ozaru-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl
Size 8.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
64ef275b2bba55a53d6260b7d11445c928348782c0b3f48dddcf8421b5b165b2
BLAKE2b-256 checksum
How to use checksums
4b689f85d661d00a3841e827954f7e796a78b3985ea9c810f5164cfd71a20a08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ozaru 0.1.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.7 This release

8 release files No 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