Skip to main content

🐂 🐍 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.

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

Uploaded CPython 3.11+Windows x86-64

oxenai-0.53.3-cp311-abi3-manylinux_2_34_x86_64.whl (30.9 MB view details)

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

oxenai-0.53.3-cp311-abi3-manylinux_2_34_aarch64.whl (29.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

oxenai-0.53.3-cp311-abi3-macosx_11_0_arm64.whl (29.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

oxenai-0.53.3-cp311-abi3-macosx_10_13_x86_64.whl (31.8 MB view details)

Uploaded CPython 3.11+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: oxenai-0.53.3-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 30.5 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.53.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 997e1f1f43440ddc4ccaf5a3abdc01b258f974b835899c5fc039f4ae624c812d
MD5 08c5b01010e1be70f38619f05dfddb09
BLAKE2b-256 131fa7151a8a688d017fdf0b644e9989d08698d48e20b4c0c853e630dad9d65d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.53.3-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 20b727d193a15ce32625f3c03fe4a6289b96bc8bbeb1b37e809a6635e9b057da
MD5 de12fec4cbe67ef50ef7a675d1b8710d
BLAKE2b-256 0309e1750f79d095694328a239099ce0af8be73dc7efee554ef49b09832db057

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.53.3-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 77dcc3cf8bfe517bcdd7e48ab240549876bb5bcc5aad42005d3ee50718e5c13b
MD5 f483da5079f898f96b93d2e6e7acf9a9
BLAKE2b-256 f5ebe9f0313a832baa17d1f441f8dd34699f0e18e5f4f7ce8a5feba82d16c299

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.53.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18bd798efc88f41426168ef623da4ec70c4587c6bd389c066a7f98bb98a34c13
MD5 e72fd4aea4f04ff56975d6179ade455b
BLAKE2b-256 b8f781362a61176ea2d2ef8ddfce9d7c930f8f50fb7a80ad10a547b5790e3175

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oxenai-0.53.3-cp311-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9e4228057fb580e4838b67f51e68fd5611f8bc3f8647e115398c017a689801d7
MD5 8237c756af45ca771a9ea840598b4181
BLAKE2b-256 7943606bc25587f9b845b6027f9cc06fa4267edf4a69b050eda26bc78d99c7e6

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 Sentry Error logging StatusPage Status page