René's URL Explorer Experiment


Title: Let plugins customize class MRO · Issue #4527 · python/mypy · GitHub

Open Graph Title: Let plugins customize class MRO · Issue #4527 · python/mypy

X Title: Let plugins customize class MRO · Issue #4527 · python/mypy

Description: The Python metaclass data model allows the mro() method to be overloaded. This is a genuinely useful feature for dealing with metaclasses whose classes must support inheritance. See "Example" below. I wrote a mypy plugin for type-checkin...

Open Graph Description: The Python metaclass data model allows the mro() method to be overloaded. This is a genuinely useful feature for dealing with metaclasses whose classes must support inheritance. See "Example" below...

X Description: The Python metaclass data model allows the mro() method to be overloaded. This is a genuinely useful feature for dealing with metaclasses whose classes must support inheritance. See "Example&q...

Opengraph URL: https://github.com/python/mypy/issues/4527

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Let plugins customize class MRO","articleBody":"The Python metaclass data model allows the `mro()` method to be overloaded. This is a genuinely useful feature for dealing with metaclasses whose classes must support inheritance. See \"Example\" below.\r\n\r\nI wrote a `mypy` plugin for type-checking instances of my metaclass. I was able to model its semantics almost correctly with the existing plugin hooks, except for one thing — customizing the MRO.\r\n\r\nThe best way I can get my type-checker unblocked is by adding a plugin hook for customizing the MRO. My idea is roughly this:\r\n - Move `calculate_class_mro` to be a member of `SemanticAnalyzerPass2`\r\n - Add a plugin hook that gets to customize the computed MRO.\r\n\r\n@JukkaL, does this sound like a feature you would take?\r\n\r\n\r\nExample of needing to customize the MRO:\r\n - My metaclass `M` injects a implementation-detail base `M_classname_base` into each class it creates. `M`'s semantics demand that `M_classname_base` be at the very end of the MRO (to allow overloading of its features).\r\n - Let us define `class A(metaclass=M)` and `class  B(A)`.\r\n - Each class injects its own base: `M_A_base` and `M_B_base`. That means that `B` actually has both implementation-detail bases.\r\n - Unfortunately, `M_A_base` and `M_B_base` conflict, and `M_B_base` ends up **after** `M_A_base` in the MRO, which is the opposite of what you want (child must overload parent, not vice versa). \r\n - At runtime, `M.mro()` can simply remove the `A`-produced base from `B`'s MRO, and all is well.\r\n - In current `mypy`, removing `M_A_base` from `B`'s MRO seems impossible.\r\n\r\nCc: @carljm, if you're curious.\r\n","author":{"url":"https://github.com/snarkmaster","@type":"Person","name":"snarkmaster"},"datePublished":"2018-01-31T23:41:35Z","url":"https://github.com/python/mypy/issues/4527"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0ecf99b8-1a8f-cecb-cd9a-a423056bb4a6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDAAA:22E601:4D024A:679C81:6B002EF0
html-safe-noncecbcc1bbd538dd8abc3d9be2a245661778dc547db8f8db44c0829512fd00cd128
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUFBOjIyRTYwMTo0RDAyNEE6Njc5QzgxOjZCMDAyRUYwIiwidmlzaXRvcl9pZCI6IjEzMTE0OTIyMTQzNjY0MTY2MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc03b9d621fbdac4ca6328c09af78068b466edc4101563411024053bbfe44953f
hovercard-subject-tagissue:293352700
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/4527/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2dde1cfe892ccc73ef18b1a6488f19c271c6c84eb64acf097998f2d3c48af0ad/python/mypy/issues/4527
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2dde1cfe892ccc73ef18b1a6488f19c271c6c84eb64acf097998f2d3c48af0ad/python/mypy/issues/4527
og:image:altThe Python metaclass data model allows the mro() method to be overloaded. This is a genuinely useful feature for dealing with metaclasses whose classes must support inheritance. See "Example" below...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesnarkmaster
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/4527#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F4527
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%2Fmypy%2Fissues%2F4527
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/4527
Reloadhttps://github.com/python/mypy/issues/4527
Reloadhttps://github.com/python/mypy/issues/4527
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests547 (547)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/4527
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/4527
Let plugins customize class MROhttps://github.com/python/mypy/issues/4527#top
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Jan 31, 2018https://github.com/python/mypy/issues/4527#issue-293352700
@JukkaLhttps://github.com/JukkaL
@carljmhttps://github.com/carljm
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Feb 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-362119723
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Feb 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-362125249
snarkmaster@63f4aa4https://github.com/snarkmaster/mypy/commit/63f4aa493c0d262bdfc831a0aed7dd0fb95f21a0
https://docs.python.org/3/library/stdtypes.html?highlight=mro#class.mrohttps://docs.python.org/3/library/stdtypes.html?highlight=mro#class.mro
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Feb 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-362127181
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Feb 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-362132346
https://github.com/zopefoundation/ExtensionClass/blob/825fbf48a01eaf70d273ca9e9175f7465b38ba14/src/ExtensionClass/__init__.pyhttps://github.com/zopefoundation/ExtensionClass/blob/825fbf48a01eaf70d273ca9e9175f7465b38ba14/src/ExtensionClass/__init__.py
http://www.memonic.com/user/danilo/folder/django/id/1xmoohttp://www.memonic.com/user/danilo/folder/django/id/1xmoo
https://stackoverflow.com/questions/20822850/change-python-mro-at-runtimehttps://stackoverflow.com/questions/20822850/change-python-mro-at-runtime
http://stupidpythonideas.blogspot.com/2015/12/can-you-customize-method-resolution.htmlhttp://stupidpythonideas.blogspot.com/2015/12/can-you-customize-method-resolution.html
http://pybites.blogspot.com/2009/01/mro-magic.htmlhttp://pybites.blogspot.com/2009/01/mro-magic.html
https://github.com/python/cpython/blob/master/Lib/test/test_descr.pyhttps://github.com/python/cpython/blob/master/Lib/test/test_descr.py
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Feb 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-362133804
snarkmasterhttps://github.com/snarkmaster
on Feb 13, 2018https://github.com/python/mypy/issues/4527#event-1470744567
Add a `customize_class_mro` plugin hookhttps://github.com/snarkmaster/mypy/commit/fd08a52bf107e2f3529ce479d16b21ad421acf3e
fd08a52https://github.com/snarkmaster/mypy/commit/fd08a52bf107e2f3529ce479d16b21ad421acf3e
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Aug 1, 2018https://github.com/python/mypy/issues/4527#issuecomment-409750068
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Aug 2, 2018https://github.com/python/mypy/issues/4527#issuecomment-409767776
Pyrsistenthttp://pyrsistent.readthedocs.io/en/latest/intro.html
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Aug 2, 2018https://github.com/python/mypy/issues/4527#issuecomment-409771830
gvanrossumhttps://github.com/gvanrossum
on Aug 2, 2018https://github.com/python/mypy/issues/4527#event-1766627222
snarkmasterhttps://github.com/snarkmaster
on Aug 5, 2018https://github.com/python/mypy/issues/4527#event-1771785475
Add a `customize_class_mro` plugin hookhttps://github.com/snarkmaster/mypy/commit/5ed1b38b799471660ca8cdadccc1e84895771bf6
5ed1b38https://github.com/snarkmaster/mypy/commit/5ed1b38b799471660ca8cdadccc1e84895771bf6
https://github.com/snarkmaster
snarkmasterhttps://github.com/snarkmaster
on Aug 6, 2018https://github.com/python/mypy/issues/4527#issuecomment-410580243
Add a customize_class_mro plugin hook #4567https://github.com/python/mypy/pull/4567
snarkmasterhttps://github.com/snarkmaster
on Sep 2, 2018https://github.com/python/mypy/issues/4527#event-1822118046
Add a `customize_class_mro` plugin hookhttps://github.com/snarkmaster/mypy/commit/7eef3852e1d3f9a581a791cf4d7ab02a9c0f5172
7eef385https://github.com/snarkmaster/mypy/commit/7eef3852e1d3f9a581a791cf4d7ab02a9c0f5172
Add a `customize_class_mro` plugin hookhttps://github.com/snarkmaster/mypy/commit/98b369bfaf3e53991da05d837b98081cff4a327d
98b369bhttps://github.com/snarkmaster/mypy/commit/98b369bfaf3e53991da05d837b98081cff4a327d
ilevkivskyihttps://github.com/ilevkivskyi
on Sep 3, 2018https://github.com/python/mypy/issues/4527#event-1822470240
Add a `customize_class_mro` plugin hook (#4567)https://github.com/python/mypy/commit/940c9b9664250660b05d4a57f6bb80011c5e6da0
#4567https://github.com/python/mypy/pull/4567
940c9b9https://github.com/python/mypy/commit/940c9b9664250660b05d4a57f6bb80011c5e6da0
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Sep 3, 2018https://github.com/python/mypy/issues/4527#issuecomment-417974041
#4567https://github.com/python/mypy/pull/4567
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 3, 2018https://github.com/python/mypy/issues/4527#event-1822470370
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/4527
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/4527
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.