Use importlib.resources to load typeshed resources
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
Use importlib.resources to load the typeshed resources, instead of finding them relative to __file__ in build.py.
Pitch
In android, we build all python binaries into self-contained zip files. So __file__ resolves to a path in a zip, and reading files relative to it fails. importlib.resources can handle both the zip case and the directory case transparently.
Currently we are using --custom-typeshed-dir as a workaround. (Code not public yet)
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 in build.py, where typeshed resources are currently found relative to file. Replace that resource-loading approach with importlib.resources, then verify that loading works both from a directory and from a self-contained zip, which is the expected definition of done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100