René's URL Explorer Experiment


Title: Protocols in typing extensions by ilevkivskyi · Pull Request #464 · python/typing · GitHub

Open Graph Title: Protocols in typing extensions by ilevkivskyi · Pull Request #464 · python/typing

X Title: Protocols in typing extensions by ilevkivskyi · Pull Request #464 · python/typing

Description: This PR is essentially an adaptation of #417, here are some comments: There is only infrastructure for user-defined protocols, all existing ABCs like Iterable etc. will be kept nominal for some time. I tried to support all versions of typing, but it looks like 3.5.0 and 3.5.1 are too hard. There is some code duplication and recourse to private API, I tried to minimize this, but Protocol really needs to be special in many aspects (like Generic). The implementation is on conservative/safe side with respect to structural subtyping, i.e. attributes should be actually defined, not just declared in a subclass, see examples in the description of #417 @Michael0x2a @vlasovskikh I will be grateful for a code review and/or playing with this and commenting whether the behaviour matches your expectations. cc @JukkaL @ambv @gvanrossum

Open Graph Description: This PR is essentially an adaptation of #417, here are some comments: There is only infrastructure for user-defined protocols, all existing ABCs like Iterable etc. will be kept nominal for some ti...

X Description: This PR is essentially an adaptation of #417, here are some comments: There is only infrastructure for user-defined protocols, all existing ABCs like Iterable etc. will be kept nominal for some ti...

Opengraph URL: https://github.com/python/typing/pull/464

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d034a78a-3791-a65d-f6f2-1b8e32952718
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB31C:12476C:F28DFE:13AE0F3:6AFFF13E
html-safe-noncefe220d93780b831b911382edf61e5570cc649aa196b57a937de94777c780fb45
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzFDOjEyNDc2QzpGMjhERkU6MTNBRTBGMzo2QUZGRjEzRSIsInZpc2l0b3JfaWQiOiI1MzQzNjc1NTA5NzczNDMxMTAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac1f8bd0ad797f0eb337e1a9915d684c68673842ddb43744ccd4a04bfd17721758
hovercard-subject-tagpull_request:136604954
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/typing/pull/464/files
twitter:imagehttps://avatars.githubusercontent.com/u/12005495?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/12005495?s=400&v=4
og:image:altThis PR is essentially an adaptation of #417, here are some comments: There is only infrastructure for user-defined protocols, all existing ABCs like Iterable etc. will be kept nominal for some ti...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/typing git https://github.com/python/typing.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id24604008
octolytics-dimension-repository_nwopython/typing
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24604008
octolytics-dimension-repository_network_root_nwopython/typing
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
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/typing/pull/464/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fpull%2F464%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fpull%2F464%2Ffiles
Sign uphttps://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%2Ftyping
Reloadhttps://github.com/python/typing/pull/464/files
Reloadhttps://github.com/python/typing/pull/464/files
Reloadhttps://github.com/python/typing/pull/464/files
pythonhttps://github.com/python
typinghttps://github.com/python/typing
Codehttps://github.com/python/typing
Issues206 (206)https://github.com/python/typing/issues
Pull requests27 (27)https://github.com/python/typing/pulls
Discussionshttps://github.com/python/typing/discussions
Actionshttps://github.com/python/typing/actions
Security and qualityhttps://github.com/python/typing/security
Insightshttps://github.com/python/typing/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Ftyping%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Ftyping%2Fissues%2Fnew%2Fchoose
gvanrossumhttps://github.com/gvanrossum
python:masterhttps://github.com/python/typing/tree/master
ilevkivskyi:protocols-typing-extensionshttps://github.com/ilevkivskyi/typehinting/tree/protocols-typing-extensions
Conversation 68 https://github.com/python/typing/pull/464
Commits 35 https://github.com/python/typing/pull/464/commits
Checks 0 https://github.com/python/typing/pull/464/checks
Files changed https://github.com/python/typing/pull/464/files
Please reload this pagehttps://github.com/python/typing/pull/464/files
Protocols in typing extensions https://github.com/python/typing/pull/464/files#top
Show all changes 35 commits https://github.com/python/typing/pull/464/files
1ebd3f5 Adapt Protocol and runtime from PR #417 ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/1ebd3f5963ace7241f3c7d0794e838fcbe824955
37b6a7b An attempt to fix missing failure on some versions ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/37b6a7ba44e81a5ea63014c9f25f4a7a56bebff5
bb3a8a9 Fix missing import ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/bb3a8a9067594e1a0ae5d0d3a9ee2fa00e822ec8
d8ae30e Fix another missing import ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/d8ae30ebf2332cf0e239fa7a58c052be5c425685
a4e68ff And another missing import ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/a4e68ff4515457c4f83b0c07030ed44b9ba4f95c
c8076ee Abandon attempts to support protocols in 3.5.0 and 3.5.1, see #195 ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/c8076ee0dc40cca660f2c5ac2d089d40a0611ed0
80e8014 Attempt to keep support of 3.5.2 ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/80e8014411e1d66a30a5b5684868d4fc270032a4
a6a631a Hopefully last backward compatibility nit ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/a6a631a876992fd453004bd49b5ca1ee93599102
5913fe6 Skip some irrelevant tests ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/5913fe6f25418efbc5904415d363f42652255e2c
faf4ff0 Conditionally add Protocol and runtime to __all__ ilevkivskyi Aug 19, 2017 https://github.com/python/typing/pull/464/commits/faf4ff08f2be895285252336bfc4c7e7143eb3b7
c7f6b68 Tweaks following Jelle's comments ilevkivskyi Aug 20, 2017 https://github.com/python/typing/pull/464/commits/c7f6b68c3a49416489c55a46e0cfe02660f48a20
8151355 Allow Protocol tests on 3.5.1 ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/8151355076da15585be9c57868ccf3f02e5ab461
76a7ecd Fix constannt NO_PROTOCOL definition ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/76a7ecd17d183fcbfbff6dd7a32dddb9f3fe38be
95faebe Add super() argument ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/95faebe9a82d41313d28ab66c28c73aaa759e154
04f1c51 Fix typo ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/04f1c511dd2fd7cd814ae55d4d203e8c198540c5
ce4e04f Fix super() ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/ce4e04ffd3ef2dcecd5f91f6c34d14061d660dc1
a7cf2fb Fix super() second attemt ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/a7cf2fbe24317d9baa95203a0c4e67828b73a8c8
8b50c60 Attempt an alternative solution ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/8b50c605d278ea177a247d0653c32329c5783f80
1dc1971 Fix _gorg in typing 3.5.1 ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/1dc1971d6a8a387cd76167f5acee7b68be402e94
e25077f Disable some tests for old-style generics and add one new instead ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/e25077f813c6f724314cd1388a99955c62122644
1c1d9fe Add some tests as proposed by Michael ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/1c1d9fed02756ee68383afeb67c1cafada3e4c29
9b22594 More tests per Michael's CR; remove redundant extra; drop old-style c… ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/9b22594235ffb9b1a881a14bab06a4aa17892c8e
458b232 Fix _gorg on Python 2; add 3.6.2 to Travis ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/458b232305a0a29a589d8620557c916cdef3485b
dbc6def First part of Jukka's CR ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/dbc6defc218509209086aafca874803e172d0a2d
31cbe0d Second part of Jukka's CR: docstrings and comments ilevkivskyi Sep 2, 2017 https://github.com/python/typing/pull/464/commits/31cbe0db5369bdfe2b1e7eac9bb8660948f62f02
171b1e5 Update one comment in test ilevkivskyi Sep 3, 2017 https://github.com/python/typing/pull/464/commits/171b1e50e9fe57f419754397d0f16e819c186fbe
fc0ec94 Don't support issubclass() for protocols with non-method members ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/fc0ec944d8e86d32e649b47979c0212819f1b01d
f1f478a Add more tests ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/f1f478a0fc2ab03471b2dc0196fa33fb97f12d56
8652ced Only apply the None rule to callable attributes on class ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/8652cedf6ac3fa886df3fee9bb57b89a0a1dec59
8f0a778 Add more tests ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/8f0a778d48b894ff6dd4d86226445c25f5653029
23e80da Backport latest changes and tests on Python 2 ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/23e80da6c1ae44f0c25c736c7200a8fe9dbe6679
dc01948 Fix lint ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/dc01948fb0fb93b0be4094a8580ee054fe64d144
733016d Fix Python 3.6+ tests ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/733016df5261e19c93c77fa9cfc40cbf7091a1e8
8f12689 One more Python 3.6+ fix ilevkivskyi Sep 9, 2017 https://github.com/python/typing/pull/464/commits/8f1268949cf21138d611ffff21f3593d9ff8524d
a4d397e Address CR ilevkivskyi Sep 14, 2017 https://github.com/python/typing/pull/464/commits/a4d397ee2ec0836a914f69e2cc08478b9ab01f2c
Clear filters https://github.com/python/typing/pull/464/files
Please reload this pagehttps://github.com/python/typing/pull/464/files
Please reload this pagehttps://github.com/python/typing/pull/464/files
.travis.yml https://github.com/python/typing/pull/464/files#diff-6ac3f79fc25d95cd1e3d51da53a4b21b939437392578a35ae8cd6d5366ca5485
README.rst https://github.com/python/typing/pull/464/files#diff-b8cad6311b3b127b015adbc53867b4b839f303776b6870e7c1c733cdcc30b52b
test_typing_extensions.py https://github.com/python/typing/pull/464/files#diff-e9cccab1e892633e323df4a42fa0b0487bab9595945bab476c680a7d27f1d77d
typing_extensions.py https://github.com/python/typing/pull/464/files#diff-bb0262c7ebe1919123b26b80c9d83d6e100d596c79ad31f75badd4c6fd5e9059
test_typing_extensions.py https://github.com/python/typing/pull/464/files#diff-573b481ee548084748cf9c7506892c80acba80c31b949d04186a14e5ab9aaca9
typing_extensions.py https://github.com/python/typing/pull/464/files#diff-f0803ded65451c15975e3661c0baf698f357eb47f32fc66f3fc6e17cea9734c6
.travis.ymlhttps://github.com/python/typing/pull/464/files#diff-6ac3f79fc25d95cd1e3d51da53a4b21b939437392578a35ae8cd6d5366ca5485
View file https://github.com/ilevkivskyi/typehinting/blob/a4d397ee2ec0836a914f69e2cc08478b9ab01f2c/.travis.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typing/pull/464/{{ revealButtonHref }}
https://github.com/python/typing/pull/464/files#diff-6ac3f79fc25d95cd1e3d51da53a4b21b939437392578a35ae8cd6d5366ca5485
https://github.com/python/typing/pull/464/files#diff-6ac3f79fc25d95cd1e3d51da53a4b21b939437392578a35ae8cd6d5366ca5485
typing_extensions/README.rsthttps://github.com/python/typing/pull/464/files#diff-b8cad6311b3b127b015adbc53867b4b839f303776b6870e7c1c733cdcc30b52b
View file https://github.com/ilevkivskyi/typehinting/blob/a4d397ee2ec0836a914f69e2cc08478b9ab01f2c/typing_extensions/README.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typing/pull/464/{{ revealButtonHref }}
https://github.com/python/typing/pull/464/files#diff-b8cad6311b3b127b015adbc53867b4b839f303776b6870e7c1c733cdcc30b52b
https://github.com/python/typing/pull/464/files#diff-b8cad6311b3b127b015adbc53867b4b839f303776b6870e7c1c733cdcc30b52b
https://github.com/python/typing/pull/464/files#diff-b8cad6311b3b127b015adbc53867b4b839f303776b6870e7c1c733cdcc30b52b
Please reload this pagehttps://github.com/python/typing/pull/464/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.