Add a `Distribution.editable` property
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by tracing the Distribution API and its origin data, then review PEP 610's direct_url.json rules for dir_info and editable. Done means the new property exposes a boolean and returns false when origin or editable information is absent.
Written by the indexing model from the issue text.
Description
Recently, when trying to check if a distribution is editable, I noticed doing so using the current API is very un-ergonomic. This information is available via the direct_url.json file of PEP 610, which is exposed in Distribution.origin.
When url refers to a local directory, the dir_info key MUST be present as a dictionary with the following key:
editable(type:boolean):trueif the distribution was installed in editable mode,falseotherwise. If absent, default tofalse.
So, to check if the distribution is editable, we can check Distribution.origin.dir_info.editable, however, Distribution.origin might be None (no direct_url.json), and Distribution.origin.dir_info might not be set (url in direct_url.json in not a local directory), which.
is_editable = distribution.origin and distribution.origin.dir_info and distribution.origin.dir_info.editable
try:
is_editable = distribution.origin.dir_info.editable
except AttributeError:
is_editable = False
It would be helpful to have this information available via a more ergonomic API.
- Dominant language
- Python
- Stars
- 142
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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.
More from python/importlib_metadata
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python/importlib_metadata#535 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
python/importlib_metadata#528 · 4 comments ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python/importlib_metadata#526 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python/importlib_metadata#525 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
python/importlib_metadata#540 · 1 comment ·
All issues in python/importlib_metadata
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·