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. Pages are counted by OZARU ENGINE, ozaru's own PDF engine, and text is extracted by pdf_oxide until the engine takes over.
  • 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.2.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 ozaru 0.2.0
File Size Uploaded Provenance Actions
ozaru-0.2.0.tar.gz 159.1 kB Without provenance Details for ozaru-0.2.0.tar.gz

Built distributions (wheels)

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

Total release size: 60.3 MB

Release files / ozaru-0.2.0.tar.gz

Download URL ozaru-0.2.0.tar.gz
Size 159.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56d1dfb2042db80922ac86d2380c4769a245d9f267f583b2b96fca1a60f8ead8
BLAKE2b-256 checksum
How to use checksums
c6c128beabf53d4f652a04dcb2b58c31364eabc6878f26044b98766be1f43813
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.2.0-cp310-abi3-win_amd64.whl

Download URL ozaru-0.2.0-cp310-abi3-win_amd64.whl
Size 8.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ccd69558bb90c009b9f04915798d8f57b46cdc38009a472a96bfe22737a1b250
BLAKE2b-256 checksum
How to use checksums
cce23f53b2d622fcbc6dc4aa56083bfffd4cc954bcf42ef33a8520461be86a7c
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.2.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL ozaru-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 9.2 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
ece6ffebe75c3cf8ccc5f14fbc94b85b9262c25406ae3287da4fedb58e9cdb02
BLAKE2b-256 checksum
How to use checksums
bf693b6bf457c56aba0643aa885ab4a4f9d2b992a7e5cd0d93e80afa72fdb4e8
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.2.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL ozaru-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 8.9 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
47919e4e4f294741390648ce05ed707761b3fe5a1799cd49d94eaa79644e2006
BLAKE2b-256 checksum
How to use checksums
140e7e33a14b763e723da2c188c76930e318fd91774307eb3078476811ed9ecb
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.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ozaru-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.8 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
ffab0ab042bbc149791a2baa04467e37b0c7173d84ed29c37e240e222426a3b4
BLAKE2b-256 checksum
How to use checksums
d1b60ba8f485d31df960afd8811e2a54bab77adef954e7b7c6e22c22da076a0f
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.2.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ozaru-0.2.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 8.7 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
01297ee7673e195d4b300fc8524e66326f564689e991e6d4b7b28011d3bc2ebc
BLAKE2b-256 checksum
How to use checksums
29b235d26a34dca80eef71668df154c7ea3776b56c8d5134bb0726c89ba37465
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.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL ozaru-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 8.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
625c027ae46979ec66ff6b10f3596ab1fe41ae9dc3ce6d5724c77a434aab0692
BLAKE2b-256 checksum
How to use checksums
c55d1cc02536ca5f773adb133fc606d3eaf700a597cca9920ec27e3b760f0d1d
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.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ozaru-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 8.4 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
468447b552ec72fe110a9daeb27e1b8b14b3b6502062e76a6a32b2c944321e27
BLAKE2b-256 checksum
How to use checksums
a5a70a1982b184440ef833c00b0bd6e52c58e1f6d0fe52683be841af7b7e58f9
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.2.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.

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