You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explain what is meant for ResourceReader to be "superseded by" TraversableResources.
Document the TraversableResources interface (its files method).
Explain that TraversableResources is a concrete implementation of ResourceReader, where only files is abstract, not an abstract base class as stated.
Under the resources heading, demarcate the old (soon to be deprecated) API from the new API and discourage usage of the old API.
Document the Traversable interface. This is a particularly pernicious one because without documentation users do not know which attributes of a pathlib.Path object, which is what would be typically returned from files(), are safe to use, and which methods are safe to call, with which arguments.
Explain what is meant for ResourceReader to be "superseded by" TraversableResources.
Perhaps it could be made clearer, but it is explained. TraversableResources takes your files() and implements ResourceReader. I am not sure how we would reword it, though.
Defining ResourceReader directly is superseded by using TraversableResources instead and just defining files(). You still get the ResourceReader implementation for compatibility, but you make available a files() API, which is a much better abstraction than what we had before.
Document the TraversableResources interface (its files method).
Yup. This was on my TODO list, I meant to do it earlier this week but it feel down.
Explain that TraversableResources is a concrete implementation of ResourceReader, where only files is abstract, not an abstract base class as stated.
This goes into the first point, we could update the description to be clearer.
Under the resources heading, demarcate the old (soon to be deprecated) API from the new API and discourage usage of the old API.
Yup. I think the docs could use a touch-up. I was meaning to add an API reference section, which would clearly mark the legacy API as deprecated or slated for deprecation, whatever we end up doing. Ideally, the rest of the documentation would only reference this API in the migration sections. I am gonna wait for resolution on #80 to do this.
Document the Traversable interface. This is a particularly pernicious one because without documentation users do not know which attributes of a pathlib.Path object, which is what would be typically returned from files(), are safe to use, and which methods are safe to call, with which arguments.
I realize it's a little awkward having issues in this repo and also bpo, especially for importlib.resources, whose code lives primarily here but whose docs are exclusively in CPython but where there's a separate set of docs for this project. For the future, please consider filing docs bugs for importlib.resources in bpo.
Since some work has been done and this issue seems to be languishing, I'm going to go ahead and close it. That said, I'd welcome anyone to re-invigorate the conversation or provide PRs to improve the situation.
Activity
FFY00 commentedon Oct 22, 2021
Perhaps it could be made clearer, but it is explained.
TraversableResourcestakes yourfiles()and implementsResourceReader. I am not sure how we would reword it, though.Defining
ResourceReaderdirectly is superseded by usingTraversableResourcesinstead and just definingfiles(). You still get theResourceReaderimplementation for compatibility, but you make available afiles()API, which is a much better abstraction than what we had before.Yup. This was on my TODO list, I meant to do it earlier this week but it feel down.
python/cpython#29173
This goes into the first point, we could update the description to be clearer.
Yup. I think the docs could use a touch-up. I was meaning to add an API reference section, which would clearly mark the legacy API as deprecated or slated for deprecation, whatever we end up doing. Ideally, the rest of the documentation would only reference this API in the migration sections. I am gonna wait for resolution on #80 to do this.
python/cpython#29039
https://docs.python.org/3.11/library/importlib.html#importlib.abc.Traversable
layday commentedon Oct 22, 2021
Not sure I understand why that can't be backported to 3.9 and 3.10 if the docs are maintained independently?
layday commentedon Oct 22, 2021
python/cpython#29039 has
but
nameis a property there.FFY00 commentedon Oct 22, 2021
Agh!
jaraco commentedon Oct 31, 2021
I'd also wait on a call for python/cpython#29036 as that PR is the one that marks the functions as deprecated.
jaraco commentedon Oct 31, 2021
I realize it's a little awkward having issues in this repo and also bpo, especially for
importlib.resources, whose code lives primarily here but whose docs are exclusively in CPython but where there's a separate set of docs for this project. For the future, please consider filing docs bugs for importlib.resources in bpo.jaraco commentedon Jul 7, 2023
Since some work has been done and this issue seems to be languishing, I'm going to go ahead and close it. That said, I'd welcome anyone to re-invigorate the conversation or provide PRs to improve the situation.