Skip to content

Make more operations in AsyncLocalFileSystem actually async #81

Backlog

Description

@PeterJCLaw

Thanks for providing this library. I use fsspec in a few projects (mostly via universal-pathlib) which are async and it's great to have an async option for local usage in order to have a consistent API.

Something I noticed in the AsyncLocalFileSystem implementation is that most operations, even those related to file io (rather than file-system io) aren't using aiofile when it appears that they could. I'm thinking of things like _write_text1, which doesn't use the open_async due to the methods they wrap calling AbstractFileSystem.open (which is synchronous).

Perhaps I'm missing something, however this feels like a missed opportunity to make the most of aiofile offering a complete async file interface.

I noticed that the base AsyncFileSystem doesn't implement those methods in terms of open_async as AbstractFileSystem does for open, so perhaps there's something I'm missing which makes that undesirable? And/or is this something which would be better fixed by implementing them there as defaults, rather than requiring every async implementation to build them from scratch?

Would you be open to a PR which added this support?

Footnotes

  1. _write_text, _write_bytes, _read_text, _read_bytes, _put_file, _pipe_file. ↩

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions