Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/numpy/__config__.py: 6%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is generated by numpy's build process
2# It contains system_info results at the time of building this package.
3from enum import Enum
4from numpy._core._multiarray_umath import (
5 __cpu_features__,
6 __cpu_baseline__,
7 __cpu_dispatch__,
8)
10__all__ = ["show_config"]
11_built_with_meson = True
14class DisplayModes(Enum):
15 stdout = "stdout"
16 dicts = "dicts"
19def _cleanup(d):
20 """
21 Removes empty values in a `dict` recursively
22 This ensures we remove values that Meson could not provide to CONFIG
23 """
24 if isinstance(d, dict):
25 return {k: _cleanup(v) for k, v in d.items() if v and _cleanup(v)}
26 else:
27 return d
30CONFIG = _cleanup(
31 {
32 "Compilers": {
33 "c": {
34 "name": "clang",
35 "linker": r"ld.bfd",
36 "version": "18.1.8",
37 "commands": r"clang",
38 "args": r"",
39 "linker args": r"",
40 },
41 "cython": {
42 "name": "cython",
43 "linker": r"cython",
44 "version": "3.1.2",
45 "commands": r"cython",
46 "args": r"",
47 "linker args": r"",
48 },
49 "c++": {
50 "name": "clang",
51 "linker": r"ld.bfd",
52 "version": "18.1.8",
53 "commands": r"clang++",
54 "args": r"",
55 "linker args": r"",
56 },
57 },
58 "Machine Information": {
59 "host": {
60 "cpu": "x86_64",
61 "family": "x86_64",
62 "endian": "little",
63 "system": "linux",
64 },
65 "build": {
66 "cpu": "x86_64",
67 "family": "x86_64",
68 "endian": "little",
69 "system": "linux",
70 },
71 "cross-compiled": bool("False".lower().replace("false", "")),
72 },
73 "Build Dependencies": {
74 "blas": {
75 "name": "auto",
76 "found": bool("False".lower().replace("false", "")),
77 "version": "",
78 "detection method": "",
79 "include directory": r"",
80 "lib directory": r"",
81 "openblas configuration": r"",
82 "pc file directory": r"",
83 },
84 "lapack": {
85 "name": "lapack",
86 "found": bool("False".lower().replace("false", "")),
87 "version": "",
88 "detection method": "",
89 "include directory": r"",
90 "lib directory": r"",
91 "openblas configuration": r"",
92 "pc file directory": r"",
93 },
94 },
95 "Python Information": {
96 "path": r"/usr/local/bin/python3",
97 "version": "3.11",
98 },
99 "SIMD Extensions": {
100 "baseline": __cpu_baseline__,
101 "found": [
102 feature for feature in __cpu_dispatch__ if __cpu_features__[feature]
103 ],
104 "not found": [
105 feature for feature in __cpu_dispatch__ if not __cpu_features__[feature]
106 ],
107 },
108 }
109)
112def _check_pyyaml():
113 import yaml
115 return yaml
118def show(mode=DisplayModes.stdout.value):
119 """
120 Show libraries and system information on which NumPy was built
121 and is being used
123 Parameters
124 ----------
125 mode : {`'stdout'`, `'dicts'`}, optional.
126 Indicates how to display the config information.
127 `'stdout'` prints to console, `'dicts'` returns a dictionary
128 of the configuration.
130 Returns
131 -------
132 out : {`dict`, `None`}
133 If mode is `'dicts'`, a dict is returned, else None
135 See Also
136 --------
137 get_include : Returns the directory containing NumPy C
138 header files.
140 Notes
141 -----
142 1. The `'stdout'` mode will give more readable
143 output if ``pyyaml`` is installed
145 """
146 if mode == DisplayModes.stdout.value:
147 try: # Non-standard library, check import
148 yaml = _check_pyyaml()
150 print(yaml.dump(CONFIG))
151 except ModuleNotFoundError:
152 import warnings
153 import json
155 warnings.warn("Install `pyyaml` for better output", stacklevel=1)
156 print(json.dumps(CONFIG, indent=2))
157 elif mode == DisplayModes.dicts.value:
158 return CONFIG
159 else:
160 raise AttributeError(
161 f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
162 )
165def show_config(mode=DisplayModes.stdout.value):
166 return show(mode)
169show_config.__doc__ = show.__doc__
170show_config.__module__ = "numpy"