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

Rethink API - ephemeral/temporary/permanent #4

Open
effigies opened this issue Jul 21, 2024 · 0 comments
Open

Rethink API - ephemeral/temporary/permanent #4

effigies opened this issue Jul 21, 2024 · 0 comments

Comments

@effigies
Copy link
Member

effigies commented Jul 21, 2024

Right now, we have three methods:

  • readable() - Guarantees the resource is readable
  • as_path() - Context manager that guarantees the resource is an existing Path
  • cached() - Guarantees the resource is an existing Path throughout the program life

This reflects that we're really just wrapping the importlib.resources API along with an interpreter-lifetime cache, but if part of the reason to use this is to file the edges off of IR, maybe we should think a little more abstractly. We could instead write these as:

  • ephemeral() - The data is accessible with a limited interface
  • temporary() - The data is temporarily accessible with a full interface
  • permanent() - The data is permanently accessible with a full interface

Perhaps this would be clearer to somebody who isn't already in the weeds of IR and just wants to understand the semantics of our loader?

Also, do we think it's worth keeping the __call__() behavior as the safe-but-potentially-wasteful cached()/permanent(), or remove it and always be explicit?

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

1 participant