Skip to main content

🐂 🐍 Oxen Python Interface

The Oxen python interface makes it easy to integrate Oxen datasets directly into machine learning dataloaders or other data pipelines.

Repositories

There are two types of repositories one can interact with, a Repo and a RemoteRepo.

Local Repo

To fully clone all the data to your local machine, you can use the Repo class.

import oxen

repo = oxen.Repo("path/to/repository")
repo.clone("https://hub.oxen.ai/ox/CatDogBBox")

If there is a specific version of your data you want to access, you can specify the branch when cloning.

repo.clone("https://hub.oxen.ai/ox/CatDogBBox", branch="my-pets")

Once you have a repository locally, you can perform the same operations you might via the command line, through the python api.

For example, you can checkout a branch, add a file, commit, and push the data to the same remote you cloned it from.

import oxen

repo = oxen.Repo("path/to/repository")
repo.clone("https://hub.oxen.ai/ox/CatDogBBox")
repo.checkout()

Remote Repo

If you don't want to download the data locally, you can use the RemoteRepo class to interact with a remote repository on OxenHub.

import oxen

repo = oxen.RemoteRepo("https://hub.oxen.ai/ox/CatDogBBox")

To stage and commit files to a specific version of the data, you can checkout an existing branch or create a new one.

repo.create_branch("dev")
repo.checkout("dev")

You can then stage files to the remote repository by specifying the file path and destination directory.

repo.add("new-cat.png", "images") # Stage to images/new-cat.png on remote
repo.commit("Adding another training image")

Note that no "push" command is required here, since the above code creates a commit directly on the remote branch.

Build 🔨

See the prerequisites section of the main readme before developing.

To get and build dependencies, as well as the oxen-python code, run:

uv sync --verbose

To build the PyO3 oxen wrappers only, use maturin and --no-sync:

uv run --no-sync maturin develop

Test

Run pytest:

uv run --verbose pytest -s tests/

If you have already installed all dependencies, and you're not making any changes to liboxen, then you may use --no-sync:

uv run --no-sync pytest -s tests/

Format and lint code with:

uvx ruff check .
uvx ruff format .

Logging

Oxen uses structured logging. It outputs to STDERR by default but can be configured with rotating log files. See Logging for details.

By default, the oxen-python does not perform any logging. Set RUST_LOG to change.

Release files for oxenai 0.57.0

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

Built distributions (wheels)

Table of built distributions (wheels) for oxenai 0.57.0
File
oxenai-0.57.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
oxenai-0.57.0-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details
oxenai-0.57.0-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details
oxenai-0.57.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
oxenai-0.57.0-cp311-abi3-macosx_10_13_x86_64.whl CPython 3.11 abi3 macOS 10.13+ x86-64 Details

Total release size: 152.3 MB

Release files / oxenai-0.57.0-cp311-abi3-win_amd64.whl

Download URL oxenai-0.57.0-cp311-abi3-win_amd64.whl
Size 30.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5f3bf71234b5cad6eceaab0b4f69487199ebaa576141a690bd79e7c6f599af64
BLAKE2b-256 checksum
How to use checksums
d53ea6bf807c02ffb269fa0864e82aa778ecbe9c107de6d407ca6e09ea0d5884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.57.0-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL oxenai-0.57.0-cp311-abi3-manylinux_2_34_x86_64.whl
Size 31.0 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
2d3a16e1b26018e27f86d716b2f46fd5444d2add8ebcbd506fe22ff30d2df517
BLAKE2b-256 checksum
How to use checksums
a27f26a720c97fdbc5bdeae7acd778cd94b0865e8d79f2ee3bdbad4eebe8a344
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.57.0-cp311-abi3-manylinux_2_34_aarch64.whl

Download URL oxenai-0.57.0-cp311-abi3-manylinux_2_34_aarch64.whl
Size 29.4 MB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
7f8420dd0bcd399dcd4e17149c6dc3900cfe39f7ab1ef0bd0aab43cc9184b762
BLAKE2b-256 checksum
How to use checksums
38aef9c3b60c3b07fd5fa027ee61fa93b16a80ef9be68d622a3b683afcb007ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.57.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL oxenai-0.57.0-cp311-abi3-macosx_11_0_arm64.whl
Size 29.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c38d068cdbbf7c1c5e17ae3e937933b8f04bd661552514abf11b9817e560338f
BLAKE2b-256 checksum
How to use checksums
c397c440599f46b0853134af3cff97aa52b5ed82b0f4016ab483625c934d459b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.57.0-cp311-abi3-macosx_10_13_x86_64.whl

Download URL oxenai-0.57.0-cp311-abi3-macosx_10_13_x86_64.whl
Size 31.9 MB
Tags CPython 3.11 abi3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
ab39a7e7c89c6ddf65962982ffa17b4aeef343edba64d31a7908cbb91b7f162f
BLAKE2b-256 checksum
How to use checksums
596a4c9115dcf4318f68f74a8ee0188486b4d7a67960cf96acbe084de75c713e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4
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