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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.52.2-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.2-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: oxenai-0.52.2-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.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 50e8d0234366306a6470c03aaf0a8b07821e5c2efc250f95d9efe913c7df97e7
MD5 3426311a5307de71b65d9fed0dcf047e
BLAKE2b-256 2422822fc08c8bb32822a12045e2460432bd7221950b825e3da015e9aca8195d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.2-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a1d6fc363c3125e4e5cdb1d6b05f88cda2bf373d7be6967195b6f37fb8c5214f
MD5 15ea9712cd462ba73ca7ba5c2bd69d33
BLAKE2b-256 965d748e9021eb7af162e7129e64b50e26ede62c93cdccfe1eb6c939e1b3ee44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.2-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 a665a7b169361d76a739c0e668080ce0e8443ad04bd1015ee44dca53923ca4bb
MD5 2e6d662e0cf4503d6547be3d238e9c52
BLAKE2b-256 fa04d9f876c778dc761dd53cff834d9a33aa367bd9139b81934318f0690c6133

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fdd3b5123f0932385596c210706a758c5fc4a968fd55cfe749a1982112f9b41
MD5 0a135b4c038b4b70118d959fe8c2264b
BLAKE2b-256 c3463d5ebc5692cc20ea1643d3bb71e8dfdd0c52a35a14ee901f36a6c584910d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.52.2-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7e5ced6ef3c0284a5d13747502b51a0c5bfa48cd30a8e4e5286acbe7a2e0b581
MD5 c37e24243412d8ce58093344308d5c3d
BLAKE2b-256 7fd2d9c60651c2a6749764e8dd2185afbadd71e735ac173dc8a52c53565240d5

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