René's URL Explorer Experiment


Title: Redesign import handling · Issue #8584 · python/mypy · GitHub

Open Graph Title: Redesign import handling · Issue #8584 · python/mypy

X Title: Redesign import handling · Issue #8584 · python/mypy

Description: The way mypy deals with imports is quite confusing. I'm proposing that we reconsider how various import-related features work. There are existing issues that cover some of these, but I want to discuss the changes in a central location he...

Open Graph Description: The way mypy deals with imports is quite confusing. I'm proposing that we reconsider how various import-related features work. There are existing issues that cover some of these, but I want to disc...

X Description: The way mypy deals with imports is quite confusing. I'm proposing that we reconsider how various import-related features work. There are existing issues that cover some of these, but I want to ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Redesign import handling ","articleBody":"The way mypy deals with imports is quite confusing. I'm proposing that we reconsider how various import-related features work. There are existing issues that cover some of these, but I want to discuss the changes in a central location here, since many of these are related. \r\n\r\nI'd love to hear what everybody thinks about this proposal! My idea is that all (or most) of the changes below would be implemented as part of a big overhaul, though likely not in a single mypy release. I think that the current situation is sufficiently problematic that small incremental changes aren't enough.\r\n\r\n**1. Enable namespace packages by default**\r\n\r\nMypy would support namespace packages by default. Currently `--namespace-packages` is needed, which is confusing for new users, in particular.\r\n\r\n**2. Generalize specifying namespace packages on the command line**\r\n\r\nAllow passing namespace packages using all the supported ways of specifying which files to type check on the command line. (See also #5759.)\r\n\r\n**3. Require package roots to be explicitly specified**\r\n\r\nTo support namespace packages properly, the way mypy currently infers module name from a source file path by looking for `__init__.py` files can't be used, since namespace packages don't contain `__init__.py` files. Instead, all package roots would need to be explicitly defined using the mypy module search path. Some package roots will be enabled by default, such as the current directory and typeshed stub directories.\r\n\r\nWe may want to tweak how the module search path is specified, since many additional users might need to use it.\r\n\r\n**4. Use modular typeshed, and don't ship (most) third party package stubs with mypy**\r\n\r\nThis is unrelated to namespace packages, but will be essential to allow typeshed to grow significantly. As third-party stubs would now be installed as packages, this would also make PEP-561 and non-PEP-561 packages behave closer to each other (for both you'll have to install some package first). Currently PEP 561 packages require a very different workflow, which is confusing.\r\n\r\nThis assumes that we'll actually switch to a modular typeshed. I'm hoping that we'll make progress in the next few months.\r\n\r\n**5. Allow selectively processing arbitrary installed packages**\r\n\r\nMake it possible to opt-in to type checking individual installed packages, even if they don't support PEP 561. This was proposed in #8545. This would be make it easier to get basic support for many third party packages that don't have stubs and don't support PEP 561.\r\n\r\nThis isn't enabled by default since some packages won't work properly or at all (C extensions, for example). One option would be disallow this option by default for popular packages with known issues.\r\n\r\n**6. Rethink import related error messages**\r\n\r\nTypical import related error messages should give explicit instructions about how to solve the issue. Ignoring missing imports should rarely be needed, and not recommended in the documentation. Examples of what might be suggested:\r\n\r\n* Install stub package `\u003cpackage>` (this will be particularly important once we move to modular typeshed)\r\n* Install package `\u003cpackage>` (in case it's known to support PEP 561)\r\n* Give the command line options that allow using an installed package (in case stubs don't exist, but the package is importable)\r\n* Update the module search path (if it doesn't look like a third-party library module)\r\n\r\n**7. Add flag to use the old module name inference behavior**\r\n\r\nProvide a backward compatibility option to use the old behavior of inferring module names, as migrating from the old behavior can be non-trivial for large projects. Still, the key of this proposal is that the new, backward incompatible behavior will be enabled by default, and should be used by most users.\r\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2020-03-25T14:09:48Z","url":"https://github.com/python/mypy/issues/8584"}

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:0c4ab738-7070-b898-d061-a2e5cc907faf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE544:26206F:2D7D3B2:3BF0A9D:6B001DFB
html-safe-nonceeacc150ef53bc945017a3977c449ffbb18f0a79d023bbcf753f84b290b6f9a1f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTQ0OjI2MjA2RjoyRDdEM0IyOjNCRjBBOUQ6NkIwMDFERkIiLCJ2aXNpdG9yX2lkIjoiMzU1ODAxNTU2NjIzOTI0Mzc3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac62eaeece37e61a0882bd92e4da54cdb5980d574810597b7ef4081a4d625be441
hovercard-subject-tagissue:587723993
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/8584/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7ee33fd541e3ed058ea92305da420bae0a6ca780bc876c7819918a0adc591149/python/mypy/issues/8584
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7ee33fd541e3ed058ea92305da420bae0a6ca780bc876c7819918a0adc591149/python/mypy/issues/8584
og:image:altThe way mypy deals with imports is quite confusing. I'm proposing that we reconsider how various import-related features work. There are existing issues that cover some of these, but I want to disc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJukkaL
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
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
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/8584#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F8584
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%2F8584
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/8584
Reloadhttps://github.com/python/mypy/issues/8584
Reloadhttps://github.com/python/mypy/issues/8584
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 requests546 (546)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/8584
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/8584
Redesign import handling https://github.com/python/mypy/issues/8584#top
metaIssues tracking a broad area of workhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22meta%22
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Mar 25, 2020https://github.com/python/mypy/issues/8584#issue-587723993
#5759https://github.com/python/mypy/issues/5759
#8545https://github.com/python/mypy/issues/8545
JukkaLhttps://github.com/JukkaL
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
on Mar 25, 2020https://github.com/python/mypy/issues/8584#event-3164134893
https://github.com/warsaw
warsawhttps://github.com/warsaw
on Mar 30, 2020https://github.com/python/mypy/issues/8584#issuecomment-606285864
this commenthttps://github.com/python/mypy/issues/1645#issuecomment-522782310
ilevkivskyihttps://github.com/ilevkivskyi
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
on Apr 1, 2020https://github.com/python/mypy/issues/8584#event-3189085172
https://github.com/ashb
ashbhttps://github.com/ashb
on Sep 9, 2020https://github.com/python/mypy/issues/8584#issuecomment-689501720
https://github.com/jnsnow
jnsnowhttps://github.com/jnsnow
on Oct 21, 2020https://github.com/python/mypy/issues/8584#issuecomment-713747255
#5759https://github.com/python/mypy/issues/5759
https://github.com/timstaley
timstaleyhttps://github.com/timstaley
on Oct 29, 2020https://github.com/python/mypy/issues/8584#issuecomment-718514932
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Oct 29, 2020https://github.com/python/mypy/issues/8584#issuecomment-718962266
@timstaleyhttps://github.com/timstaley
find_sources: find build sources recursively #9614https://github.com/python/mypy/pull/9614
modulefinder: make -p handle namespace packages correctly #9616https://github.com/python/mypy/pull/9616
@jnsnowhttps://github.com/jnsnow
#9632https://github.com/python/mypy/pull/9632
https://github.com/jnsnow
jnsnowhttps://github.com/jnsnow
on Oct 30, 2020https://github.com/python/mypy/issues/8584#issuecomment-719813712
#9632https://github.com/python/mypy/pull/9632
hauntsaninjahttps://github.com/hauntsaninja
on Oct 31, 2020https://github.com/python/mypy/issues/8584#event-3943592312
build: log build sources with -vhttps://github.com/hauntsaninja/mypy/commit/70002e941ef3328680520e83119ee59e9e7c24e6
70002e9https://github.com/hauntsaninja/mypy/commit/70002e941ef3328680520e83119ee59e9e7c24e6
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Oct 31, 2020https://github.com/python/mypy/issues/8584#issuecomment-719864657
@jnsnowhttps://github.com/jnsnow
#9672https://github.com/python/mypy/pull/9672
hauntsaninjahttps://github.com/hauntsaninja
on Oct 31, 2020https://github.com/python/mypy/issues/8584#event-3944443404
build: log build sources with -v (#9672)https://github.com/python/mypy/commit/fd16f84a2d692ce3712d3da3251561d6af03261b
#9672https://github.com/python/mypy/pull/9672
fd16f84https://github.com/python/mypy/commit/fd16f84a2d692ce3712d3da3251561d6af03261b
bonzinihttps://github.com/bonzini
on May 30, 2021https://github.com/python/mypy/issues/8584#event-4817472872
python: add mypy to pipenvhttps://github.com/qemu/qemu/commit/f81fa0ae4ed4e88ad2b764870c99871926c8885a
f81fa0ahttps://github.com/qemu/qemu/commit/f81fa0ae4ed4e88ad2b764870c99871926c8885a
python: add mypy to pipenvhttps://github.com/qemu/qemu/commit/0542a4c95767b2370cb6622efe723bb6197aa04c
0542a4chttps://github.com/qemu/qemu/commit/0542a4c95767b2370cb6622efe723bb6197aa04c
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Sep 26, 2021https://github.com/python/mypy/issues/8584#issuecomment-927361405
#9636https://github.com/python/mypy/pull/9636
#8545https://github.com/python/mypy/issues/8545
#9789https://github.com/python/mypy/issues/9789
#10660https://github.com/python/mypy/issues/10660
#10456https://github.com/python/mypy/issues/10456
#10044https://github.com/python/mypy/issues/10044
#10619https://github.com/python/mypy/issues/10619
#10310https://github.com/python/mypy/issues/10310
#10820https://github.com/python/mypy/issues/10820
emmatypinghttps://github.com/emmatyping
metaIssues tracking a broad area of workhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22meta%22
on May 19, 2022https://github.com/python/mypy/issues/8584#event-6641376152
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Aug 10, 2023https://github.com/python/mypy/issues/8584#issuecomment-1672879026
#10600 (comment)https://github.com/python/mypy/issues/10600#issuecomment-950170169
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Nov 12, 2023https://github.com/python/mypy/issues/8584#issuecomment-1807270913
#16472https://github.com/python/mypy/issues/16472
hauntsaninjahttps://github.com/hauntsaninja
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 12, 2023https://github.com/python/mypy/issues/8584#event-10935570000
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/8584
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/8584
metaIssues tracking a broad area of workhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22meta%22
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
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.