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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.52.4-cp311-abi3-macosx_11_0_arm64.whl (29.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.52.4-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.52.4-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: oxenai-0.52.4-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.52.4-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 915cb6d7b82b18ab3ea5b8f41754e2616050dae87d33c03e2a33c147ed2c5d81
MD5 7c27181564817b3d0a494fee7f2bc07b
BLAKE2b-256 838e0b3d08e5d9e7f2eb86c8c6a3772eb1bc721132e5e3011bc401fc59bbc4d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.4-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 632a80f93bb170f3d1933bc2cb94de90b97a6ce145b215464df0b8b7de6201a7
MD5 97b04f091c1a2c51c59b63e8af8d892d
BLAKE2b-256 8e937d8517e3194ef7901c993af5d490e4e2ba5362f2ea7afa4f7eee84f35145

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.4-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e9fe60990c5b88b5960e79dd893d3aaa40fd0addc609a92636d6d01666d46e32
MD5 d2326b26af6dcd5eed2554d74ea5d6fa
BLAKE2b-256 5a290c2d2960a2533e1486c5231896e074f4de841d7aedcd82ecb8d4f16c7854

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.4-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f8c0de840123edf791f653687b709e61130bef9ca6af540509211a8a8416887
MD5 3309869c813f7b626360ed88b1ab53a4
BLAKE2b-256 6a3443551d3613aaea1e1d2b75078ea85abf7679544d684a49d7d58b4cd6ee89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.4-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0ebfe7e2a710f3166ec8b01263b0b154418594b0176654985b6add87d12e9551
MD5 3f893ec640d86bc92ebc19c25ba12df4
BLAKE2b-256 e24303d9ddb22eda96d8037294538fffdf6cd7df905dd49a61a5174e7980dcf4

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