Skip to content

Support for async StacIO #1545

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

Open
philvarner opened this issue Apr 6, 2025 · 1 comment
Open

Support for async StacIO #1545

philvarner opened this issue Apr 6, 2025 · 1 comment
Milestone

Comments

@philvarner
Copy link
Collaborator

Filing this ticket here as a precursor to supporting async is pystac-client:

Currently:

  • pystac only supports sync reads (from file or URL) and writes (to file). The desire to to also support an async API, so that users who wish to use this in an async context don't have to block or wrap calls in an executor.
  • file i/o is done via the open built-in
  • network i/o is done via urllib

Ideally, we would have as little duplicated code as possible, though the actual code for doing the i/o is pretty small (low tens of lines), and would easy to maintain if not shared, and the added complexity of contorting the code to work with or without the async keyword is probably not worth it.

File I/O

Continue to use built-io i/o for sync, and aiofiles library for async.

Network I/O

One approach to this is to use the api-compatible pairs of libraries for sync and async, e.g., requests / niquests (sync) and httpx (async) or urllib (sync, and currently used) and urllib3.future (async) (maybe? I don't know how similar urllib3 and urllib are?).

Or, just have a bit of duplicated-ish code and use urllib for sync (no external dependency) and httpx for async.

@jsignell
Copy link
Member

jsignell commented Apr 7, 2025

This has come up before #690, #274 and always been considered not worth the effort with the current implementation of psytac. Probably something to consider for the pystac v2 rewrite: #1524

@jsignell jsignell added this to the v2.0 milestone Apr 7, 2025
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

No branches or pull requests

2 participants