Skip to content

Conversation

ilevkivskyi
Copy link
Member

Also adjust build/test logic slightly to prepare for more modules in librt. This PR should fix #20006

@ilevkivskyi
Copy link
Member Author

cc @JukkaL FYI

@ilevkivskyi
Copy link
Member Author

Hm, somehow testBufferRoundTrip_librt_internal is passing locally for me, but failing in CI. I will try to play more with it, it looks like mypycify() needs some hacks with packages.

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

OK, the problem is with librt itself. By default setuptools creates a namespace extension package, but those don't work with capsule imports well. Not sure why we don't have this issue with mypyc itself.

This comment has been minimized.

ilevkivskyi added a commit to mypyc/librt that referenced this pull request Oct 7, 2025
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

mypy (https://github.com/python/mypy)
+ mypy/cache.py:7: error: Cannot find implementation or library stub for module named "native_internal"  [import-not-found]
+ mypy/cache.py:7: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ mypy/cache.py:7: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-import-not-found for more info
+ mypy/cache.py:32: error: Argument 1 to "read_literal" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:32: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-no-any-unimported for more info
+ mypy/cache.py:34: error: Returning Any from function declared to return "Union[int, str, bool, float]"  [no-any-return]
+ mypy/cache.py:34: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-no-any-return for more info
+ mypy/cache.py:36: error: Returning Any from function declared to return "Union[int, str, bool, float]"  [no-any-return]
+ mypy/cache.py:38: error: Returning Any from function declared to return "Union[int, str, bool, float]"  [no-any-return]
+ mypy/cache.py:40: error: Returning Any from function declared to return "Union[int, str, bool, float]"  [no-any-return]
+ mypy/cache.py:44: error: Argument 1 to "write_literal" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:65: error: Argument 1 to "read_int_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:67: error: Returning Any from function declared to return "Optional[int]"  [no-any-return]
+ mypy/cache.py:71: error: Argument 1 to "write_int_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:79: error: Argument 1 to "read_str_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:81: error: Returning Any from function declared to return "Optional[str]"  [no-any-return]
+ mypy/cache.py:85: error: Argument 1 to "write_str_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:93: error: Argument 1 to "read_int_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:98: error: Argument 1 to "write_int_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:104: error: Argument 1 to "read_str_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:109: error: Argument 1 to "write_str_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:115: error: Argument 1 to "read_str_opt_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/cache.py:120: error: Argument 1 to "write_str_opt_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:271: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:275: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:427: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:437: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:721: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:738: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1032: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1050: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1144: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1151: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1336: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1346: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1475: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:1482: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:2908: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:2918: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:2958: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:2967: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:3026: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:3036: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:3918: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:3953: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4284: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4295: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4570: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4600: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4664: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4683: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4737: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4745: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4764: error: Argument 1 to "write_flags" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4769: error: Argument 1 to "read_flags" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4905: error: Argument 1 to "read_symbol" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/nodes.py:4929: error: Argument 1 to "read_overload_part" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:301: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:305: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:438: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:445: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:717: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:729: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:869: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:881: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:949: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:961: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1105: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1113: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1215: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1220: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1324: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1331: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1385: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1389: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1424: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1428: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1478: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1483: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1541: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1547: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1686: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:1715: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2053: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2062: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2579: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2598: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2694: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2699: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2802: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2809: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2984: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:2992: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3247: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3253: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3360: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3366: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3505: error: Argument 2 to "write" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:3510: error: Argument 2 to "read" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4204: error: Argument 1 to "read_type" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4248: error: Argument 1 to "read_function_like" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4257: error: Argument 1 to "read_type_var_like" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4268: error: Argument 1 to "read_type_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4274: error: Argument 1 to "write_type_opt" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4282: error: Argument 1 to "read_type_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4287: error: Argument 1 to "write_type_list" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4293: error: Argument 1 to "read_type_map" becomes "Any" due to an unfollowed import  [no-any-unimported]
+ mypy/types.py:4298: error: Argument 1 to "write_type_map" becomes "Any" due to an unfollowed import  [no-any-unimported]
- mypy/modulefinder.py:20: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- mypy/modulefinder.py:20: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-import-not-found for more info
- mypy/modulefinder.py:728: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-no-any-unimported for more info

@ilevkivskyi
Copy link
Member Author

The mypy_primer output is expected, if there are no objections, I am going to merge this shortly.

@ilevkivskyi ilevkivskyi merged commit f2ebd79 into python:master Oct 7, 2025
20 checks passed
@ilevkivskyi ilevkivskyi deleted the rename-native-internal branch October 7, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy nightly crashes with ModuleNotFoundError: No module named 'native_internal'
1 participant