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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.49.1-cp311-abi3-manylinux_2_34_x86_64.whl (30.7 MB view details)

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

oxenai-0.49.1-cp311-abi3-manylinux_2_34_aarch64.whl (29.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.49.1-cp311-abi3-macosx_11_0_arm64.whl (29.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.49.1-cp311-abi3-macosx_10_13_x86_64.whl (31.6 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: oxenai-0.49.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 31.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.49.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8688c9988399d55924a1e425f3c60edd6254ace85fc4358b66d39e28088b0c26
MD5 fb920385090ab14fabbd57496c7ea8be
BLAKE2b-256 3da3a2b8674bbdc81db5ec6ba490c6d42d815c88bb4ac09bb747054c48713cfe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.49.1-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 41712d1a6b5d613596b6c0a89cbb3a4b226d3dc933e2b33ff9a4e4d00ff92709
MD5 933786d0c0ea00fd2a651c6c55cbad5e
BLAKE2b-256 97be8530c38f9f5b8815baa630a2f0a6e26d6c6c174f6b64834a51d867dbf1ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.49.1-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 eac974be7ca1b3054152b42a869594189b1845dbcf5a1629e8294faa2e42e272
MD5 c9b581a26c5782b4a9c4ebad23f29eb6
BLAKE2b-256 0e12f5bd86748550cbe569a5e029878426bcea843cb87a66084aff10cac2e10e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.49.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3300a6a42d031a69848dfd620c4713f3d4b886f91380304a7a6e17e129a495b1
MD5 965a59f61c45eb4fb92f4d5253688b2a
BLAKE2b-256 88badb5f149f12ffeab5476515d31fae752b7c64a15818814bd43d5a9d57b2e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.49.1-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 510d494dda6c1da4d8f6201411c1a1be4b7db1c0766adb31a5e6474c5c96cb3a
MD5 6868f46ec403905c4fa2b5126921169e
BLAKE2b-256 01eab5ec6b6898577a7b00e7b99b06574d8ed6a06d218fb5ba06f184abbd205b

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