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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.50.1-cp311-abi3-manylinux_2_34_x86_64.whl (28.6 MB view details)

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

oxenai-0.50.1-cp311-abi3-manylinux_2_34_aarch64.whl (27.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.50.1-cp311-abi3-macosx_11_0_arm64.whl (27.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.50.1-cp311-abi3-macosx_10_13_x86_64.whl (29.6 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: oxenai-0.50.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 29.3 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.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fd4391694d79fe91e54b739be88ea538d49340ed770ce14bbf4c5fbfa974f632
MD5 2f52846ef8d85df1ed4eb0fe6b80c13c
BLAKE2b-256 d8952ee10372099c70fdb0b668a417fd48b26ddb7c9652dbf4d8494861dc75c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.1-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2ffbe91529cae033fe6ad1819effd293c917a1abdfb5040f9a86f691e83fd0ef
MD5 c44cde20bdf5217bef5c3c34f49f9ad2
BLAKE2b-256 3c2b07b30c63adc9d22320dc85121818bee13986b584901c75e79b8936093b98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.1-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 bac1b5d05f7c07cfe84db1cead4bb95b11af6658fea6befc7eb6563c9e73ee39
MD5 0787d8823b0ea427c1b47f7bf45b1bea
BLAKE2b-256 cff0c83c30020afadcd8e3d03ca1fa31a0e0c3dee3fbed1b796c9448fb6af94b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7d034f23c2e71a20f99862b5b0606ed5e97779dd8119846ddd23526eb210d17
MD5 e8fd08caece6008a280c878643ebb6a1
BLAKE2b-256 a1dd28f35c04d03d8a9a272c242346b56a6a1212881de6f4ee7c964037a99851

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.50.1-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 320ec4015b2027d216d095c1a4d868f659ab2f041898e13042fb6f56f5495d37
MD5 2dac8e7dbaae079b326dc0c95c5b8ce3
BLAKE2b-256 aa3b5959c2c0248fb169db66970b1bfad0dfd8918d20e2c9149f488a75efc1d6

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