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.9-cp311-abi3-win_amd64.whl (30.4 MB view details)

Uploaded CPython 3.11+Windows x86-64

oxenai-0.52.9-cp311-abi3-manylinux_2_34_x86_64.whl (30.9 MB view details)

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

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

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.52.9-cp311-abi3-macosx_11_0_arm64.whl (29.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.52.9-cp311-abi3-macosx_10_13_x86_64.whl (31.8 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: oxenai-0.52.9-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 30.4 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.9-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 86d1c5d169e920a0b9fdcb408f3c5edcc3021630123d9c9cfbf0705ea9a0ef17
MD5 71aabe539c8a91dbfd0299bab2bbf167
BLAKE2b-256 0b0e467bd1c242af82cf7e44d0accb1894b03301ca1ab73b0b565ac9a59c72e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.9-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e3001631b92c7c4b595c9376a2d8313906e1d31687d81481b873704d2ef057d4
MD5 63e7c5170cc5f1fe7e2508f0fded0f6e
BLAKE2b-256 6eac9680b995a268ce978a8c2d57e0f35431040d3cbfd5c660c589111dbdd258

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.9-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 01556058aebf9b81f0da84be674465b774a4d1e853680e225e5a9a814de6ba6b
MD5 71136e8ea4c325cf8045be76f74db08b
BLAKE2b-256 2f0fc298db69169a6856ed8ee613238828b581a8d69e8db32830fd0567115ddf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.9-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77bfc5fae0ea95c942145711f1d13ba6ae2f6702e99d83da4efd5b323c227196
MD5 6a93a6d3fec5d11b9b4f05a28d85fbdb
BLAKE2b-256 26e1f90b0a90782417f298a06d26466f5483ef76382de180581b6be08520a0b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.9-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ec1d78f7d1bd79ff75689e2e5b019be89598b521f6c007d5e559c89038778868
MD5 274680d5843b7862f9b2b12e45a9c950
BLAKE2b-256 dbe5368300ec5c919609101e3fcd912107cef3c9f2c4cdbd2c3f3f39f08a8668

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