René's URL Explorer Experiment


Title: bpo-24132: Add `pathlib._AbstractPath` by barneygale · Pull Request #31085 · python/cpython · GitHub

Open Graph Title: bpo-24132: Add `pathlib._AbstractPath` by barneygale · Pull Request #31085 · python/cpython

X Title: bpo-24132: Add `pathlib._AbstractPath` by barneygale · Pull Request #31085 · python/cpython

Description: After a couple of years of mostly deleting things in pathlib, I'm glad to finally offer an addition! This PR adds a new _AbstractPath class that sits between PurePath and Path in the class hierarchy. _AbstractPath objects have all the same methods as Path objects, but their filesystem-accessing methods consistently raise NotImplementedError. (updated Feb 15th: now, only stat(), open() and iterdir() are abstract; other methods that directly access the filesystem are not part of the _AbstractPath interface). This class will form the basis of a future public-facing abstract class that can be used by the likes of s3path and cloudpathlib. It could also be used to make zipfile.Path objects fully pathlib-compatible (no missing methods!) Why is this underscore-prefixed? I think this needs some time to gestate in CPython before we write full docs/tests and remove the prefix. I'd make an appeal to the authors of pathlib-y packages on PyPI to try it in an experimental branch and let us know where the pain points are. Three or so roadblocks remain before we can document and recommend it. See this comment https://bugs.python.org/issue24132

Open Graph Description: After a couple of years of mostly deleting things in pathlib, I'm glad to finally offer an addition! This PR adds a new _AbstractPath class that sits between PurePath and Path in the class hier...

X Description: After a couple of years of mostly deleting things in pathlib, I'm glad to finally offer an addition! This PR adds a new _AbstractPath class that sits between PurePath and Path in the class ...

Opengraph URL: https://github.com/python/cpython/pull/31085

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6423f8e3-c61d-7daf-b077-8fe7d700db0a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC1B0:1F9980:B2667:F4A84:696962BB
html-safe-noncea63deb855dcb14e3d88ededbbb09feb933aa6d2433fc2e9ea32a31d579630f38
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUIwOjFGOTk4MDpCMjY2NzpGNEE4NDo2OTY5NjJCQiIsInZpc2l0b3JfaWQiOiI1NDExOTAyODA0NzA1NTAxODgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5526949b0d092f83675cc9352571c60a407401ba8135cb85b0121f10e58f16d8
hovercard-subject-tagpull_request:838567192
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/31085/files
twitter:imagehttps://avatars.githubusercontent.com/u/960340?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/960340?s=400&v=4
og:image:altAfter a couple of years of mostly deleting things in pathlib, I'm glad to finally offer an addition! This PR adds a new _AbstractPath class that sits between PurePath and Path in the class hier...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None48487c1ad776a7975b7132d95f4240ff3ae37cd5b8e3cb597102a4edb76738f1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release669463fcc54773a88c1f5a44eef6b99a5504b9c7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/31085/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F31085%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F31085%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/31085/files
Reloadhttps://github.com/python/cpython/pull/31085/files
Reloadhttps://github.com/python/cpython/pull/31085/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
barneygalehttps://github.com/barneygale
python:mainhttps://github.com/python/cpython/tree/main
barneygale:bpo-24132-add-pathlib-abstractpathhttps://github.com/barneygale/cpython/tree/bpo-24132-add-pathlib-abstractpath
Conversation 30 https://github.com/python/cpython/pull/31085
Commits 10 https://github.com/python/cpython/pull/31085/commits
Checks 0 https://github.com/python/cpython/pull/31085/checks
Files changed https://github.com/python/cpython/pull/31085/files
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
bpo-24132: Add pathlib._AbstractPath https://github.com/python/cpython/pull/31085/files#top
Show all changes 10 commits https://github.com/python/cpython/pull/31085/files
66f8eb1 Move `Path._make_child_relpath()` to `PurePath` barneygale Feb 2, 2022 https://github.com/python/cpython/pull/31085/commits/66f8eb1fdf4783e3e4dc581f78dffc8fa3a9be59
27d8f7f Add `_AbstractPath` class barneygale Feb 2, 2022 https://github.com/python/cpython/pull/31085/commits/27d8f7f05346bc3fda7ede09cbabe7545f6a157b
47191ed Optimize `Path` methods that may raise `NotImplementedError` barneygale Feb 2, 2022 https://github.com/python/cpython/pull/31085/commits/47191edbfd5bd4c9822615f5c66012bdb21b8000
bbd7fd1 Add NEWS entry barneygale Feb 2, 2022 https://github.com/python/cpython/pull/31085/commits/bbd7fd1cbbbcd64219f6b27620cafab7534edeab
67e5e95 Subclass `abc.ABC` and decorate core methods with `@abc.abstractmethod`. barneygale Feb 11, 2022 https://github.com/python/cpython/pull/31085/commits/67e5e9582ab81c8a044b903e37646d500931a9ed
ef8d13e Remove quasi-abstract methods from AbstractPath barneygale Feb 14, 2022 https://github.com/python/cpython/pull/31085/commits/ef8d13e15502b8f096bc6878ad93501e0c8940c8
21e0ece Merge branch 'main' into bpo-24132-add-pathlib-abstractpath barneygale Feb 14, 2022 https://github.com/python/cpython/pull/31085/commits/21e0ece6810520a0b8e7ebaa9b10707455c23bbf
18a2c38 Improve _scandir() comment. barneygale Feb 14, 2022 https://github.com/python/cpython/pull/31085/commits/18a2c3896c4b88b4e518ec48c503df2d7e055a17
3312870 Remove speculation/promises from `_AbstractPath` docstring. barneygale Feb 21, 2022 https://github.com/python/cpython/pull/31085/commits/3312870453b38de035924ff5c1bc60b4a4770ef3
bcefeed Merge branch 'main' into bpo-24132-add-pathlib-abstractpath barneygale Jun 12, 2022 https://github.com/python/cpython/pull/31085/commits/bcefeed519d96bf317a5829eb497a0a03357196f
Clear filters https://github.com/python/cpython/pull/31085/files
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
pathlib.py https://github.com/python/cpython/pull/31085/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
2022-02-02-18-59-09.bpo-24132.mddFFe.rst https://github.com/python/cpython/pull/31085/files#diff-f4ae5a40fc3a3bf9276c59e05e686f0f14f22c6da0c663863d64199e82d26d57
Please reload this pagehttps://github.com/python/cpython/pull/31085/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.