MCPcopy Index your code
hub / github.com/python/mypy / CompilerOptions

Class CompilerOptions

mypyc/options.py:6–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class CompilerOptions:
7 def __init__(
8 self,
9 strip_asserts: bool = False,
10 multi_file: bool = False,
11 verbose: bool = False,
12 separate: bool = False,
13 target_dir: str | None = None,
14 include_runtime_files: bool | None = None,
15 capi_version: tuple[int, int] | None = None,
16 python_version: tuple[int, int] | None = None,
17 strict_dunder_typing: bool = False,
18 group_name: str | None = None,
19 log_trace: bool = False,
20 depends_on_librt_internal: bool = False,
21 experimental_features: bool = False,
22 strict_traceback_checks: bool = False,
23 ) -> None:
24 self.strip_asserts = strip_asserts
25 self.multi_file = multi_file
26 self.verbose = verbose
27 self.separate = separate
28 self.global_opts = not separate
29 self.target_dir = target_dir or "build"
30 self.include_runtime_files = (
31 include_runtime_files if include_runtime_files is not None else not multi_file
32 )
33 # The target Python C API version. Overriding this is mostly
34 # useful in IR tests, since there's no guarantee that
35 # binaries are backward compatible even if no recent API
36 # features are used.
37 self.capi_version = capi_version or sys.version_info[:2]
38 self.python_version = python_version
39 # Make possible to inline dunder methods in the generated code.
40 # Typically, the convention is the dunder methods can return `NotImplemented`
41 # even when its return type is just `bool`.
42 # By enabling this option, this convention is no longer valid and the dunder
43 # will assume the return type of the method strictly, which can lead to
44 # more optimization opportunities.
45 self.strict_dunders_typing = strict_dunder_typing
46 # Override the automatic group name derived from the hash of module names.
47 # This affects the names of generated .c, .h and shared library files.
48 # This is only supported when compiling exactly one group, and a shared
49 # library is generated (with shims). This can be used to make the output
50 # file names more predictable.
51 self.group_name = group_name
52 # If enabled, write a trace log of events based on executed operations to
53 # mypyc_trace.txt when compiled module is executed. This is useful for
54 # performance analysis.
55 self.log_trace = log_trace
56 # If enabled, add capsule imports of librt.internal API. This should be used
57 # only for mypy itself, third-party code compiled with mypyc should not use
58 # librt.internal.
59 self.depends_on_librt_internal = depends_on_librt_internal
60 # Some experimental features are only available when building librt in
61 # experimental mode (e.g. use _experimental suffix in librt run test).
62 # These can't be used with a librt wheel installed from PyPI.
63 self.experimental_features = experimental_features

Callers 11

mypycifyFunction · 0.90
make_builderFunction · 0.90
test_debug_opMethod · 0.90
do_optimizationsMethod · 0.90
do_optimizationsMethod · 0.90
run_caseMethod · 0.90
run_caseMethod · 0.90
run_case_stepMethod · 0.90

Calls

no outgoing calls

Tested by 10

make_builderFunction · 0.72
test_debug_opMethod · 0.72
do_optimizationsMethod · 0.72
do_optimizationsMethod · 0.72
run_caseMethod · 0.72
run_caseMethod · 0.72
run_case_stepMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…