OxenFS is a filesystem interface for Oxen repositories that implements the fsspec protocol. This allows you to interact with Oxen repositories using familiar filesystem operations and integrate with other compatible libraries like Pandas.
You must have write access to the repository to write files. See: https://docs.oxen.ai/getting-started/python#private-repositories
OxenFS will automatically commit the file to the repository when the context is exited (or the file is closed some other way). New directories are automatically created as needed.
If youโre integrating Oxen in a situation where you already have a file object,
you can save it to your repo by using shutil.copyfileobj
like this:
OxenFS works seamlessly with Pandas and other fsspec-compatible libraries using
the URL format: oxen://namespace:repo@revision/path/to/file
These will work with Pandas {to,from}_{csv,parquet,json,etc.}
functions.
Initialize the OxenFS instance.
Arguments:
namespace
- str
The namespace of the repository.repo
- str
The name of the repository.host
- str
The host to connect to. Defaults to โhub.oxen.aiโrevision
- str
The branch name or commit id to checkout. Defaults to โmainโscheme
- str
The scheme to use for the remote url. Default: โhttpsโList the contents of a directory.
Arguments:
path
- str
The path to list the contents of.detail
- bool
If True, return a list of dictionaries with detailed metadata.
Otherwise, return a list of strings with the filenames.A file writer for the OxenFS backend.
This is normally called through OxenFS.open()
or fsspec.open()
.
Write string or binary data to the file.
Flush the file to disk.
Return the current position of the file.
Seek to a specific position in the file.
Commit the file to the remote repo.
Close the file writer. This will commit the file to the remote repo.