Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1f790dc
add reader and writer options to async open
chitralverma Apr 24, 2025
2cfb6ad
Update test_write.py
chitralverma Apr 24, 2025
b409cfa
Add test_async_writer_options test stub
chitralverma Apr 24, 2025
b059afa
Enhance capability struct with additional conditional operations
chitralverma Apr 25, 2025
4f37238
Implement AsyncFile::write_from
chitralverma Apr 28, 2025
e532bbf
revert write_from
chitralverma May 26, 2025
17a44cd
Merge branch 'apache:main' into options-for-rw
chitralverma May 26, 2025
96d854b
update as per options api
chitralverma May 28, 2025
f5284ff
Merge branch 'main' into options-for-rw
chitralverma May 28, 2025
d8c8906
revert Cargo.lock
chitralverma May 28, 2025
1b390e8
Merge remote-tracking branch 'origin/options-for-rw' into options-for-rw
chitralverma May 28, 2025
5a2ded9
Merge branch 'main' into options-for-rw
chitralverma May 29, 2025
94d4891
Merge branch 'main' into options-for-rw
chitralverma May 29, 2025
438abbd
add options to blocking open
chitralverma May 30, 2025
3a8db85
fix formatting and lint
chitralverma May 30, 2025
67e44fc
Reset __base.pyi
chitralverma May 30, 2025
72bebf1
Updated `read` and `write` methods to accept `**options`
chitralverma May 30, 2025
f559ddb
Reset __base.pyi
chitralverma May 30, 2025
8860387
Merge branch 'main' into options-for-rw
chitralverma May 30, 2025
044f7a4
fix docs for sync/ async read
chitralverma May 30, 2025
43203d2
fix docs for sync/ async open
chitralverma May 30, 2025
433a2c3
fix docs for sync/ async write
chitralverma May 30, 2025
90ca323
temp fix for ConditionNotMatch test
chitralverma May 31, 2025
e6732be
set concurrent to default
chitralverma Jun 3, 2025
165b63f
update capabilities
chitralverma Jun 3, 2025
da57ef9
Merge branch 'main' into options-for-rw
chitralverma Jun 3, 2025
b1c02ab
add remaining read options
chitralverma Jun 3, 2025
9351cf2
fix formatting
chitralverma Jun 3, 2025
af6c562
updated docstrings
chitralverma Jun 3, 2025
477b7af
Merge branch 'main' into options-for-rw
chitralverma Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,22 @@ cache-keys = [
{ file = "../../core/**/*.rs" },
]

[tool.ruff]
line-length = 88
fix = true

[tool.ruff.lint]
ignore = ["E402", "F403", "F405"]
select = ["E", "F", "I"]

[tool.ruff.lint.pycodestyle]
max-doc-length = 88

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.isort]
known-first-party = ["opendal"]
320 changes: 207 additions & 113 deletions bindings/python/python/opendal/__init__.pyi

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/python/python/opendal/layers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ class ConcurrentLimitLayer(Layer):

@final
class MimeGuessLayer(Layer):
def __init__(self) -> None: ...
def __init__(self) -> None: ...
65 changes: 43 additions & 22 deletions bindings/python/src/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,57 @@ pub struct Capability {
/// If operator supports stat with if none match.
pub stat_with_if_none_match: bool,

/// If operator supports read.
/// Indicates if the operator supports read operations.
pub read: bool,
/// If operator supports read with if match.
/// Indicates if conditional read operations using If-Match are supported.
pub read_with_if_match: bool,
/// If operator supports read with if none match.
/// Indicates if conditional read operations using If-None-Match are supported.
pub read_with_if_none_match: bool,
/// if operator supports read with override cache control.
/// Indicates if conditional read operations using If-Modified-Since are supported.
pub read_with_if_modified_since: bool,
/// Indicates if conditional read operations using If-Unmodified-Since are supported.
pub read_with_if_unmodified_since: bool,
/// Indicates if Cache-Control header override is supported during read operations.
pub read_with_override_cache_control: bool,
/// if operator supports read with override content disposition.
/// Indicates if Content-Disposition header override is supported during read operations.
pub read_with_override_content_disposition: bool,
/// if operator supports read with override content type.
/// Indicates if Content-Type header override is supported during read operations.
pub read_with_override_content_type: bool,
/// Indicates if versions read operations are supported.
pub read_with_version: bool,

/// If operator supports write.
/// Indicates if the operator supports write operations.
pub write: bool,
/// If operator supports write can be called in multi times.
/// Indicates if multiple write operations can be performed on the same object.
pub write_can_multi: bool,
/// If operator supports write with empty content.
/// Indicates if writing empty content is supported.
pub write_can_empty: bool,
/// If operator supports write by append.
/// Indicates if append operations are supported.
pub write_can_append: bool,
/// If operator supports write with content type.
/// Indicates if Content-Type can be specified during write operations.
pub write_with_content_type: bool,
/// If operator supports write with content disposition.
/// Indicates if Content-Disposition can be specified during write operations.
pub write_with_content_disposition: bool,
/// If operator supports write with cache control.
/// Indicates if Content-Encoding can be specified during write operations.
pub write_with_content_encoding: bool,
/// Indicates if Cache-Control can be specified during write operations.
pub write_with_cache_control: bool,
/// write_multi_max_size is the max size that services support in write_multi.
///
/// For example, AWS S3 supports 5GiB as max in write_multi.
/// Indicates if conditional write operations using If-Match are supported.
pub write_with_if_match: bool,
/// Indicates if conditional write operations using If-None-Match are supported.
pub write_with_if_none_match: bool,
/// Indicates if write operations can be conditional on object non-existence.
pub write_with_if_not_exists: bool,
/// Indicates if custom user metadata can be attached during write operations.
pub write_with_user_metadata: bool,
/// Maximum size supported for multipart uploads.
/// For example, AWS S3 supports up to 5GiB per part in multipart uploads.
pub write_multi_max_size: Option<usize>,
/// write_multi_min_size is the min size that services support in write_multi.
///
/// For example, AWS S3 requires at least 5MiB in write_multi expect the last one.
/// Minimum size required for multipart uploads (except for the last part).
/// For example, AWS S3 requires at least 5MiB per part.
pub write_multi_min_size: Option<usize>,
/// write_total_max_size is the max size that services support in write_total.
///
/// For example, Cloudflare D1 supports 1MB as max in write_total.
/// Maximum total size supported for write operations.
/// For example, Cloudflare D1 has a 1MB total size limit.
pub write_total_max_size: Option<usize>,

/// If operator supports create dir.
Expand Down Expand Up @@ -117,6 +130,9 @@ impl Capability {
read_with_override_content_disposition: capability
.read_with_override_content_disposition,
read_with_override_content_type: capability.read_with_override_content_type,
read_with_if_modified_since: capability.read_with_if_modified_since,
read_with_if_unmodified_since: capability.read_with_if_unmodified_since,
read_with_version: capability.read_with_version,
write: capability.write,
write_can_multi: capability.write_can_multi,
write_can_empty: capability.write_can_empty,
Expand All @@ -127,6 +143,11 @@ impl Capability {
write_multi_max_size: capability.write_multi_max_size,
write_multi_min_size: capability.write_multi_min_size,
write_total_max_size: capability.write_total_max_size,
write_with_content_encoding: capability.write_with_content_encoding,
write_with_if_match: capability.write_with_if_match,
write_with_if_none_match: capability.write_with_if_none_match,
write_with_if_not_exists: capability.write_with_if_not_exists,
write_with_user_metadata: capability.write_with_user_metadata,
create_dir: capability.create_dir,
delete: capability.delete,
copy: capability.copy,
Expand Down
7 changes: 4 additions & 3 deletions bindings/python/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::sync::Arc;

use futures::AsyncReadExt;
use futures::AsyncSeekExt;
use futures::AsyncWriteExt;
use pyo3::buffer::PyBuffer;
use pyo3::exceptions::PyIOError;
use pyo3::exceptions::PyValueError;
Expand Down Expand Up @@ -335,7 +336,7 @@ pub struct AsyncFile(Arc<Mutex<AsyncFileState>>);

enum AsyncFileState {
Reader(ocore::FuturesAsyncReader),
Writer(ocore::Writer),
Writer(ocore::FuturesAsyncWriter),
Closed,
}

Expand All @@ -344,7 +345,7 @@ impl AsyncFile {
Self(Arc::new(Mutex::new(AsyncFileState::Reader(reader))))
}

pub fn new_writer(writer: ocore::Writer) -> Self {
pub fn new_writer(writer: ocore::FuturesAsyncWriter) -> Self {
Self(Arc::new(Mutex::new(AsyncFileState::Writer(writer))))
}
}
Expand Down Expand Up @@ -422,7 +423,7 @@ impl AsyncFile {

let len = bs.len();
writer
.write(bs)
.write_all(&bs)
.await
.map(|_| len)
.map_err(|err| PyIOError::new_err(err.to_string()))
Expand Down
1 change: 1 addition & 0 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ fn _opendal(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Capability>()?;

m.add_class::<WriteOptions>()?;
m.add_class::<ReadOptions>()?;

// Layer module
let layers_module = PyModule::new(py, "layers")?;
Expand Down
Loading
Loading