Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readable file around object_store::BufReader #33

Merged
merged 6 commits into from
Oct 31, 2024
Merged

Conversation

kylebarron
Copy link
Member

@kylebarron kylebarron commented Oct 22, 2024

"File-like object" wrapper

@kylebarron
Copy link
Member Author

cc @martindurant this adds a file-like object wrapper, which we could also wrap in fsspec

}

#[pyfunction]
pub(crate) fn open_async(py: Python, store: PyObjectStore, path: String) -> PyResult<Bound<PyAny>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you want to bother with open_async for now - if it's to be a file-like API, may as well just do that, and only give the blocking methods. It is a stateful object, after all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presently, this PR only provides async methods, not blocking methods. The API is meant to be similar to https://github.com/Tinche/aiofiles.

It would be a good enhancement to have two separate Python classes, one returned by open and another returned by open_async. Then the methods on the object returned by open_async would be named read() (without the async suffix) but still return coroutines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@kylebarron kylebarron Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sorry, this wasn't modeled after fsspec, but it could be used potentially in an fsspec wrapper.

@kylebarron kylebarron changed the title WIP: BufReader wrapper Readable file around object_store::BufReader Oct 31, 2024
@kylebarron kylebarron enabled auto-merge (squash) October 31, 2024 20:49
@kylebarron kylebarron merged commit 26cf681 into main Oct 31, 2024
4 checks passed
@kylebarron kylebarron deleted the kyle/readable-file branch October 31, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants