Add `pathlib.Path.metadata()` and soft-deprecate `info`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
I propose we add a pathlib.Path.metadata() method that requires a keyword-only cached argument, e.g.:
>>> m = pathlib.Path('README.txt').metadata(cached=True)
>>> m
Metadata('README.txt')
>>> m.is_file()
True
If cached is True, the method may return a Metadata object that was previously fetched and cached. If False, the return value is always up-to-date.
pathlib.Path.info should be soft-deprecated; its implementation should call self.metadata(cached=True)
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721/70
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 the linked Discourse discussion and the existing pathlib.Path.info entry point. Define the proposed metadata(cached=...) behavior and the soft-deprecation approach for info, then verify that the resulting API matches the proposal's cached and up-to-date cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100