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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.51.3-cp311-abi3-manylinux_2_34_x86_64.whl (31.0 MB view details)

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

oxenai-0.51.3-cp311-abi3-manylinux_2_34_aarch64.whl (29.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.51.3-cp311-abi3-macosx_11_0_arm64.whl (29.4 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.51.3-cp311-abi3-macosx_10_13_x86_64.whl (31.9 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: oxenai-0.51.3-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 32.2 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.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 87fc237c718bee717b393d57f12ca9a857c152984a74d715e39d13ce0fe32416
MD5 ea7702eee4c52fe6976ceca2232dce49
BLAKE2b-256 498caa822115d94743ac2a4b7eac4cf06055d97e55f3cd5d4617bde015c0217e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.3-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d617904c7e4de89b43414bac6d6e2bb235f0c01579f0b8f8a7fd7d6bfb587f35
MD5 e164c663363512be9cd74300262caacd
BLAKE2b-256 89c58fa42b2b26b94d7fb1de336487b46a200e021f99a498bdc077e13ce7440b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.3-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e947e29731304371bda3963c0fa18b32e9098e59c5dd473ae19260a6780ddfa0
MD5 01861f0644385edb2ca817d16b0c21f1
BLAKE2b-256 131311a9f4fc7253c1f1825c2110ba514f9b50b534337be35aa53778984c704b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cb0bd9b9deda992882231e2de14b3e1cd737051dee5ffdfa782ed3b1b07e96c
MD5 0f9107a0500ef9a38ebbbb012ed95a8e
BLAKE2b-256 886a7a4063927f5e5ce5e29ff6d6ecca4ab888a527d8e891116eeeb8cd18e67a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.51.3-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b3a81bb1b7b206913b475b1d2f05b2f851e236240b6c4a041c383870b861aebd
MD5 52dfefcd456148ad2894ebd309db5ab2
BLAKE2b-256 a849ba881b8fd8364ae9bdfaa4ae8ae7ec3a2c5b0c9aea7e74dba9a45c3d89c7

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