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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.50.4-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.50.4-cp311-abi3-manylinux_2_34_aarch64.whl (29.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.50.4-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.50.4-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: oxenai-0.50.4-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 31.8 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.50.4-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ef40a8bedfededdf9a78a91f4fa6b3cc229ba91508ea20c4c890d08b1d4e497b
MD5 1ef9f532ba178ee473ce7c71f13bc01b
BLAKE2b-256 8707451dadd36547cff31855807d42d6ac941e62d4d42501b3d013cbd64ad942

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.4-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f82ae0211dad6a62849f084cc6ce3679f39b7dd0f322636c24642a241acb58c6
MD5 c347cbe5030f2e5ff8c309a057053e14
BLAKE2b-256 32e7383b89399e3ef060e4472bd26fbd5d6bb592fbad8cb888968b530627dcc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.4-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 2e3c8bc35807f1a9f211497d23a4dc3cde2507ac9c5b91e180200640823daf01
MD5 08fefae9931e6dea928713ed7b7f2b5e
BLAKE2b-256 c3de58ea6d921ab6805eec05ba386710723c21cf8394f42f6839eadf43895d74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.4-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa71a633628300b13609effbd613c0dd67e68d26788af652d26d484716f3afbf
MD5 a157ee621021257aaa0f9e9b926e28f8
BLAKE2b-256 71d0246dd1dd8162540958d0c3322933d2a3bf1869c5d564e75aba405dcc4f0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.4-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3cb99ca3c4312efa4ab32d30be641a0dab812604e967cffb5cd3da8e0f64f7a9
MD5 51755726ed901f329ffa42af24b2e1b2
BLAKE2b-256 61cce5719506ac05f05c35c1b34f966c6290b6fcd7df749d73bcd972f4ba2a01

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