Skip to main content

Data version control for machine learning

Project description

🐂 🐍 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.

Project details


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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.51.5-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.51.5-cp311-abi3-manylinux_2_34_aarch64.whl (29.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.51.5-cp311-abi3-macosx_11_0_arm64.whl (28.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.51.5-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.51.5-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: oxenai-0.51.5-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.51.5-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9b5b2cb891f7df0968c4872d9eea7713b2808b2c7f952473f99eff8166f6dc03
MD5 67d339e37467bb4666fd9740c068e7dc
BLAKE2b-256 7412e8946b045bc777c070e24088d701701d737fad04d19aab61fb84ecf0698d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.5-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 84313717c7fed69380217a3469e8961ca519759b8dd0446e144fe633b95d6ea5
MD5 b85ffc1bf964c79c667ecd9e443d7e99
BLAKE2b-256 7cac2f7e67cdb43ba6d11f1e82f221755d2a97e9518dc242bcb40472600e9de2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.5-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 c2a0d00a31b207b0c6b53af7ad4550d0cf82596266689af3afb061a3fea2c1f8
MD5 12835872e6678df5cc592bb22bdab346
BLAKE2b-256 4791cd855870be44be19038c7a3ce3ab566dfaf7665a74ca8731496620c5a61d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.5-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7fed677a9e11fc11db56572201688e41b11ee56fbbea60ee9389e5e41cdef96c
MD5 d7fe87a9d871c5f9c5b7a6d346baaab1
BLAKE2b-256 d3c44121e9a39763f25c4595983698502d8af34c4d784a5af8a60fa4d2be4482

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.5-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4ab3dfa960f15df53ee530360d35a9eca0a6f51b8cb7d6a517b93f9192bfe83d
MD5 ce276a3ea39be8cc4e663a51e5a66b87
BLAKE2b-256 e2517d24baa7318b807d234b625f11fd76290cd976ae01ecdd76a9d64802c3ff

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