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.

Metadata

Release files for oxenai 0.61.1

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.61.1
File
oxenai-0.61.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
oxenai-0.61.1-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details
oxenai-0.61.1-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details
oxenai-0.61.1-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
oxenai-0.61.1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
oxenai-0.61.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
oxenai-0.61.1-cp311-abi3-macosx_10_13_x86_64.whl CPython 3.11 abi3 macOS 10.13+ x86-64 Details

Total release size: 237.2 MB

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

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

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

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

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

Download URL oxenai-0.61.1-cp311-abi3-manylinux_2_34_aarch64.whl
Size 32.8 MB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
be2901a6661186bc0883dd7b138f891ada63ad8f6a9178be11a5a1e59752a17e
BLAKE2b-256 checksum
How to use checksums
8c43e49845d3fa591ad0b4ec4bc8e753599a4c5adb01a29a51f5278ee2c7a651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.61.1-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL oxenai-0.61.1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 34.8 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
87f36c7c197bff66ebdc7f7f20e8a8d8e5d0ec8cdf952fea2e7823704a7eb3ff
BLAKE2b-256 checksum
How to use checksums
03c3a16af8d9763dc1a591788b304bfe1259a094d28483a8e40c235cc682e342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

Release files / oxenai-0.61.1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL oxenai-0.61.1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 33.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
6f010319295f0ec2e6469cddbf181aa502c898e113de336956dbc6c461c2eeff
BLAKE2b-256 checksum
How to use checksums
80584b23850a75d3fd77e7c2bd9ac79b093239456e13efbc3c4ed44bc5a2d8dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.8.4

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

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

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

Download URL oxenai-0.61.1-cp311-abi3-macosx_10_13_x86_64.whl
Size 35.3 MB
Tags CPython 3.11 abi3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
1920367db58611a491774289e7058cddaaf193925794e952a9f2e3ee8ec37957
BLAKE2b-256 checksum
How to use checksums
689b5c364a62e564af7af1729d76804d0d5c7deb5ab4f128600744fb38f8ec7b
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