tree: b0a1d98bcfddcbef331d60fbbface6081b01cf37 [path history] [tgz]
  1. benchmark/
  2. docs/
  3. python/
  4. src/
  5. template/
  6. tests/
  7. .gitignore
  8. Cargo.toml
  9. CONTRIBUTING.md
  10. DEPENDENCIES.md
  11. DEPENDENCIES.rust.tsv
  12. mkdocs.yml
  13. pyproject.toml
  14. README.md
  15. upgrade.md
  16. users.md
  17. uv.lock
bindings/python/README.md

Apache OpenDALâ„¢ Python Binding

img PyPI Website

This package intends to build a native python binding for Apache OpenDAL.

Useful Links

Installation

pip install opendal

Usage

fs service example:

import opendal

op = opendal.Operator("fs", root="/tmp")
op.write("test.txt", b"Hello World")
print(op.read("test.txt"))
print(op.stat("test.txt").content_length)

Or using the async API:

import asyncio

async def main():
    op = opendal.AsyncOperator("fs", root="/tmp")
    await op.write("test.txt", b"Hello World")
    print(await op.read("test.txt"))

asyncio.run(main())

s3 service example:

import opendal

op = opendal.Operator("s3", root="/tmp", bucket="your_bucket_name", region="your_region")
op.write("test.txt", b"Hello World")
print(op.read("test.txt"))
print(op.stat("test.txt").content_length)

Or using the async API:

import asyncio

async def main():
    op = opendal.AsyncOperator("s3", root="/tmp", bucket="your_bucket_name", region="your_region")
    await op.write("test.txt", b"Hello World")
    print(await op.read("test.txt"))

asyncio.run(main())

Development

Setup virtualenv:

uv venv --python 3.11

Install all the dependencies:

uv sync --all-groups --all-extras

Run some tests:

# To run `test_write.py` and use `fs` operator
OPENDAL_TEST=fs OPENDAL_FS_ROOT=/tmp uv run pytest -vk test_write

Build API docs:

uv run mkdocs build

Used by

Check out the users list for more details on who is using OpenDAL.

License and Trademarks

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.