oxen.oxen_fs
OxenFS Objects
Basic Usage
Creating a Filesystem Instance
Reading Files
Writing Files
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.Writing file objects
If you’re integrating Oxen in a situation where you already have a file object, you can save it to your repo by usingshutil.copyfileobj
like this:
Integration with Third Party Libraries (Pandas, etc.)
OxenFS works seamlessly with Pandas and other fsspec-compatible libraries using the URL format:oxen://namespace:repo@revision/path/to/file
Reading Data
These will work with Pandas{to,from}_{csv,parquet,json,etc.}
functions.
Writing Data
Notes
- Only binary read (“rb”) and write (“wb”) modes are currently supported
- But writing will automatically encode strings to bytes
- Does not yet support streaming files. All operations use temporary local files.
__init__
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’
ls
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.
OxenFSFileWriter Objects
OxenFS.open()
or fsspec.open()
.