MCPcopy
hub / github.com/python/mypy / mypycify

Function mypycify

mypyc/build.py:750–953  ·  view source on GitHub ↗

Main entry point to building using mypyc. This produces a list of Extension objects that should be passed as the ext_modules parameter to setup. Arguments: paths: A list of file paths to build. It may also contain mypy options. only_compile_paths: If not None, an iterab

(
    paths: list[str],
    *,
    only_compile_paths: Iterable[str] | None = None,
    verbose: bool = False,
    opt_level: str = "3",
    debug_level: str = "1",
    strip_asserts: bool = False,
    multi_file: bool = False,
    separate: bool | list[tuple[list[str], str | None]] = False,
    skip_cgen_input: (
        tuple[list[list[tuple[str, str]]], list[tuple[str, list[str], bool]]] | None
    ) = None,
    target_dir: str | None = None,
    include_runtime_files: bool | None = None,
    strict_dunder_typing: bool = False,
    group_name: str | None = None,
    log_trace: bool = False,
    depends_on_librt_internal: bool = False,
    install_librt: bool = False,
    experimental_features: bool = False,
)

Source from the content-addressed store, hash-verified

748
749
750def mypycify(
751 paths: list[str],
752 *,
753 only_compile_paths: Iterable[str] | None = None,
754 verbose: bool = False,
755 opt_level: str = "3",
756 debug_level: str = "1",
757 strip_asserts: bool = False,
758 multi_file: bool = False,
759 separate: bool | list[tuple[list[str], str | None]] = False,
760 skip_cgen_input: (
761 tuple[list[list[tuple[str, str]]], list[tuple[str, list[str], bool]]] | None
762 ) = None,
763 target_dir: str | None = None,
764 include_runtime_files: bool | None = None,
765 strict_dunder_typing: bool = False,
766 group_name: str | None = None,
767 log_trace: bool = False,
768 depends_on_librt_internal: bool = False,
769 install_librt: bool = False,
770 experimental_features: bool = False,
771) -> list[Extension]:
772 """Main entry point to building using mypyc.
773
774 This produces a list of Extension objects that should be passed as the
775 ext_modules parameter to setup.
776
777 Arguments:
778 paths: A list of file paths to build. It may also contain mypy options.
779 only_compile_paths: If not None, an iterable of paths that are to be
780 the only modules compiled, even if other modules
781 appear in the mypy command line given to paths.
782 (These modules must still be passed to paths.)
783
784 verbose: Should mypyc be more verbose. Defaults to false.
785
786 opt_level: The optimization level, as a string. Defaults to '3' (meaning '-O3').
787 debug_level: The debug level, as a string. Defaults to '1' (meaning '-g1').
788 strip_asserts: Should asserts be stripped from the generated code.
789
790 multi_file: Should each Python module be compiled into its own C source file.
791 This can reduce compile time and memory requirements at the likely
792 cost of runtime performance of compiled code. Defaults to false.
793 separate: Should compiled modules be placed in separate extension modules.
794 If False, all modules are placed in a single shared library.
795 If True, every module is placed in its own library.
796 Otherwise, separate should be a list of
797 (file name list, optional shared library name) pairs specifying
798 groups of files that should be placed in the same shared library
799 (while all other modules will be placed in its own library).
800
801 Each group can be compiled independently, which can
802 speed up compilation, but calls between groups can
803 be slower than calls within a group and can't be
804 inlined.
805 target_dir: The directory to write C output files. Defaults to 'build'.
806 include_runtime_files: If not None, whether the mypyc runtime library
807 should be directly #include'd instead of linked

Callers 1

setup.pyFile · 0.90

Calls 15

CompilerOptionsClass · 0.90
mypyc_buildFunction · 0.85
setup_mypycify_varsFunction · 0.85
get_cflagsFunction · 0.85
setClass · 0.85
listClass · 0.85
include_dirFunction · 0.85
write_fileFunction · 0.85
zipFunction · 0.85
build_using_shared_libFunction · 0.85
build_single_moduleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…