René's URL Explorer Experiment


Title: Mypy issue validating package with directory and -p arg · Issue #11234 · python/mypy · GitHub

Open Graph Title: Mypy issue validating package with directory and -p arg · Issue #11234 · python/mypy

X Title: Mypy issue validating package with directory and -p arg · Issue #11234 · python/mypy

Description: Bug Report I'm having an issue running mypy on a package with the -p argument where the package directory has a subdirectory inside it. I'm receiving the following error with mypy 0.9.10: Traceback (most recent call last): File "/Users/o...

Open Graph Description: Bug Report I'm having an issue running mypy on a package with the -p argument where the package directory has a subdirectory inside it. I'm receiving the following error with mypy 0.9.10: Traceback...

X Description: Bug Report I'm having an issue running mypy on a package with the -p argument where the package directory has a subdirectory inside it. I'm receiving the following error with mypy 0.9.10: T...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy issue validating package with directory and -p arg","articleBody":"**Bug Report**\r\nI'm having an issue running mypy on a package with the `-p` argument where the package directory has a subdirectory inside it. I'm receiving the following error with mypy 0.9.10:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/runpy.py\", line 194, in _run_module_as_main\r\n    return _run_code(code, main_globals, None,\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/__main__.py\", line 23, in \u003cmodule>\r\n    console_entry()\r\n  File \"mypy/build.py\", line 1955, in wrap_context\r\n  File \"mypy/build.py\", line 2205, in finish_passes\r\n  File \"mypy/build.py\", line 818, in report_file\r\n  File \"mypy/report.py\", line 83, in file\r\n  File \"mypy/report.py\", line 482, in on_file\r\n  File \"mypy/report.py\", line 131, in iterate_python_lines\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/tokenize.py\", line 392, in open\r\n    buffer = _builtin_open(filename, 'rb')\r\nIsADirectoryError: [Errno 21] Is a directory: 'python_tools/resources'\r\n```\r\n\r\nI tested with the master branch, and the error is the same, but the traceback is different:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/runpy.py\", line 194, in _run_module_as_main\r\n    return _run_code(code, main_globals, None,\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/__main__.py\", line 23, in \u003cmodule>\r\n    console_entry()\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/__main__.py\", line 11, in console_entry\r\n    main(None, sys.stdout, sys.stderr)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/main.py\", line 87, in main\r\n    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/main.py\", line 165, in run_build\r\n    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 179, in build\r\n    result = _build(\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 254, in _build\r\n    graph = dispatch(sources, manager, stdout)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 2707, in dispatch\r\n    process_graph(graph, manager)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 3031, in process_graph\r\n    process_stale_scc(graph, scc, manager)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 3132, in process_stale_scc\r\n    graph[id].finish_passes()\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 2220, in finish_passes\r\n    free_tree(self.tree)\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/contextlib.py\", line 131, in __exit__\r\n    self.gen.throw(type, value, traceback)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 1962, in wrap_context\r\n    yield\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 2215, in finish_passes\r\n    manager.report_file(self.tree, self.type_map(), self.options)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/build.py\", line 821, in report_file\r\n    self.reports.file(file, self.modules, type_map, options)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/report.py\", line 85, in file\r\n    reporter.on_file(tree, modules, type_map, options)\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/report.py\", line 483, in on_file\r\n    for lineno, line_text in iterate_python_lines(path):\r\n  File \"/Users/oleksiyk/virtualenv_python38/lib/python3.8/site-packages/mypy/report.py\", line 133, in iterate_python_lines\r\n    with tokenize.open(path) as input_file:\r\n  File \"/Users/oleksiyk/.pyenv/versions/3.8.9/lib/python3.8/tokenize.py\", line 392, in open\r\n    buffer = _builtin_open(filename, 'rb')\r\nIsADirectoryError: [Errno 21] Is a directory: 'python_tools/resources'\r\n```\r\n\r\nWithout the -p argument, the command passes with no issue.\r\n\r\n**Expected Behavior**\r\n\r\nI'm not too familiar with mypy, but I would expect the code to ignore such directories I think. I'm also not sure why the -p argument would cause this issue, when the code otherwise works normally. When I dug through the traceback a bit, I found this function https://github.com/python/mypy/blob/f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe/mypy/report.py#L121-L128 that seems to handle skipping different paths for mypy validation. For the sake of testing, I changed the directory name above from `resources` to `stubs`, and that fixed the error. Perhaps all directories should be ignored by this skip function (or maybe they shouldn't be passed into it in the first place, not sure)?\r\n\r\n**My Environment**\r\n\r\n- Mypy version used: 0.9.10 and 0.920+dev.209a7193feb4bbfa38d09232b0a5a916e9d2e605\r\n- Full command run: `python3.8 -m mypy --txt-report ~/tmp/mypyr_report --install-types --non-interactive --namespace-packages --ignore-missing-imports -p yahoo.contrib.mx3_python_tools --show-traceback`\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.8.9 (although in a separate env, 3.9 showed the same issue)\r\n- Operating system and version: MacOS Big Sur version 11.6","author":{"url":"https://github.com/oleksiykamenyev","@type":"Person","name":"oleksiykamenyev"},"datePublished":"2021-09-30T16:23:50Z","url":"https://github.com/python/mypy/issues/11234"}

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:0a95b26b-cf3e-da14-a81b-3f79aa6ff6d0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC80E:B5253:21FB211:2D22099:6B005136
html-safe-nonce803ee99cc97a15e12dbdd7f3818f9feb46b8e013e591825adbb043fe77792804
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODBFOkI1MjUzOjIxRkIyMTE6MkQyMjA5OTo2QjAwNTEzNiIsInZpc2l0b3JfaWQiOiIyMDM4NTMxOTYwMjY3MTAwNDcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8bf6f34ada10bf2a837a2092a46608456ec5cff73c0349f0baf47e604ceff43b
hovercard-subject-tagissue:1012379545
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/11234/issue_layout
twitter:imagehttps://opengraph.githubassets.com/364628d70b94ba2a936d8cbb952ba2c6672300c859249daece73eb5433a6a4b5/python/mypy/issues/11234
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/364628d70b94ba2a936d8cbb952ba2c6672300c859249daece73eb5433a6a4b5/python/mypy/issues/11234
og:image:altBug Report I'm having an issue running mypy on a package with the -p argument where the package directory has a subdirectory inside it. I'm receiving the following error with mypy 0.9.10: Traceback...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameoleksiykamenyev
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
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
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/11234#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F11234
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%2F11234
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/11234
Reloadhttps://github.com/python/mypy/issues/11234
Reloadhttps://github.com/python/mypy/issues/11234
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/11234
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/11234
#13733https://github.com/python/mypy/pull/13733
Mypy issue validating package with directory and -p arghttps://github.com/python/mypy/issues/11234#top
#13733https://github.com/python/mypy/pull/13733
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
https://github.com/oleksiykamenyev
oleksiykamenyevhttps://github.com/oleksiykamenyev
on Sep 30, 2021https://github.com/python/mypy/issues/11234#issue-1012379545
mypy/mypy/report.pyhttps://github.com/python/mypy/blob/f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe/mypy/report.py#L121-L128
f98f782https://github.com/python/mypy/commit/f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe
oleksiykamenyevhttps://github.com/oleksiykamenyev
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
on Sep 30, 2021https://github.com/python/mypy/issues/11234#event-5388955145
https://github.com/jamesbraza
jamesbrazahttps://github.com/jamesbraza
on Dec 19, 2021https://github.com/python/mypy/issues/11234#issuecomment-997302792
https://github.com/zevisert
zeviserthttps://github.com/zevisert
on Feb 24, 2022https://github.com/python/mypy/issues/11234#issuecomment-1049457477
AlexWaygoodhttps://github.com/AlexWaygood
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
on Mar 26, 2022https://github.com/python/mypy/issues/11234#event-6311437618
hauntsaninjahttps://github.com/hauntsaninja
on Sep 26, 2022https://github.com/python/mypy/issues/11234#event-7454407483
Fix crash with report generation on namespace packageshttps://github.com/hauntsaninja/mypy/commit/58a4e1d280cb11d571e96f48fff8bbe4b7ed3f47
https://docs.github.com/articles/closing-issues-via-commit-messages
58a4e1dhttps://github.com/hauntsaninja/mypy/commit/58a4e1d280cb11d571e96f48fff8bbe4b7ed3f47
hauntsaninjahttps://github.com/hauntsaninja
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#13733https://github.com/python/mypy/pull/13733
on Sep 27, 2022https://github.com/python/mypy/issues/11234#event-7464962540
hauntsaninjahttps://github.com/hauntsaninja
on Sep 27, 2022https://github.com/python/mypy/issues/11234#event-7464962868
Fix crash with report generation on namespace packages (#13733)https://github.com/python/mypy/commit/ab3b98fad942bb3f13f3a8f94c447433b8876ae2
#13733https://github.com/python/mypy/pull/13733
https://docs.github.com/articles/closing-issues-via-commit-messages
ab3b98fhttps://github.com/python/mypy/commit/ab3b98fad942bb3f13f3a8f94c447433b8876ae2
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/11234
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/11234
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%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.