importlib.resources.simple ResourceContainer/ResourceHandle cannot be instantiated
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
Issue
ResourceContainer and ResourceHandle cannot be instantiated because Traversable now declares name as an abstract property. Additionally, ResourceContainer.iterdir() accesses self.reader.resources without calling it, and ResourceHandle.joinpath has a signature mismatch with the base class.
Reproducer
from importlib.resources.simple import ResourceContainer, SimpleReader
import io
class R(SimpleReader):
@property
def package(self): return 'x'
def children(self): return []
def resources(self): return []
def open_binary(self, r): return io.BytesIO(b'')
ResourceContainer(R()) # TypeError: Can't instantiate abstract class ResourceContainer
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-145263
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with importlib.resources.simple and inspect ResourceContainer, ResourceHandle, SimpleReader, and their Traversable relationship. Reproduce the ResourceContainer(R()) failure, then verify the abstract-property, resources access, and joinpath issues are corrected and covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100