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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

oxenai-0.52.6-cp311-abi3-win_amd64.whl (32.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

oxenai-0.52.6-cp311-abi3-manylinux_2_34_x86_64.whl (30.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

oxenai-0.52.6-cp311-abi3-manylinux_2_34_aarch64.whl (29.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.52.6-cp311-abi3-macosx_11_0_arm64.whl (29.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.52.6-cp311-abi3-macosx_10_13_x86_64.whl (31.7 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

Details for the file oxenai-0.52.6-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: oxenai-0.52.6-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 32.0 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.4

File hashes

Hashes for oxenai-0.52.6-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 64de50c1fefe293fc1c2b48bd9ce5b0a12e95f8855f12f00db5f20bc1f36bed5
MD5 614efe524d9d1889e8c49fc7bd8faec0
BLAKE2b-256 ac51498478b8255c967142ce8b94d57e210fc3afe9c13118dce617b4da2baff4

See more details on using hashes here.

File details

Details for the file oxenai-0.52.6-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for oxenai-0.52.6-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ea01ad3d49c405051c0b58cbcc54f3469e6a7bd8313545ce09becde8aef1f6b4
MD5 eab3875557210c126d577217d9fade0a
BLAKE2b-256 2b76f115bda8dc833555365350c0ecfbcf53ae4eac3e8c608984072116a1ff5c

See more details on using hashes here.

File details

Details for the file oxenai-0.52.6-cp311-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for oxenai-0.52.6-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 4535efce1e2c3858e6c07f08abee21469e6c1145a20558c8095896c5b545462b
MD5 fe623bc6583b5800eeea355e72f3c0c7
BLAKE2b-256 b084ba42454aee90ba706538fff5724cf4512901d2641abd9884700e8e8c8b24

See more details on using hashes here.

File details

Details for the file oxenai-0.52.6-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oxenai-0.52.6-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b662ea9af2708da13b7ef74671b8b92d58d4a0be2b31a6779cbf1000ccbe2003
MD5 8d08be6e7fdf7c6b8813d79834eebc37
BLAKE2b-256 7f4ca249dd67be9d7340335d4100eeb9fa16a68dc43d13b1c2f6f1936839fb28

See more details on using hashes here.

File details

Details for the file oxenai-0.52.6-cp311-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for oxenai-0.52.6-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 46a1ce860d2e1d65f486f700cc16fa689022053010dc89e307c38c2677abfd6e
MD5 c4f20eb4ceda21e033d78e2950ed1e76
BLAKE2b-256 3d674a80d18eff9a02d28b4cda10ac108bc20583b2b80044f16e2258ce482319

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page