pyembed 0.24.0

Embed a Python interpreter
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
.. _pyembed_interpreter_config:

================================================
Python Interpreter Configuration Data Structures
================================================

This document describes the data structures for configuring the behavior of
a Python interpreter. The data structures are consumed by the ``pyembed`` Rust crate.
All type names should correspond to public symbols in the ``pyembed`` crate.

This documentation is auto-generated from the inline documentation in Rust source
files. Some formatting has been lost as part of the conversion.
See https://docs.rs/pyembed/ for the native Rust API documentation

Structs:

* :ref:`OxidizedPythonInterpreterConfig <pyembed_struct_OxidizedPythonInterpreterConfig>`
* :ref:`PythonInterpreterConfig <pyembed_struct_PythonInterpreterConfig>`

Enums:

* :ref:`MemoryAllocatorBackend <pyembed_enum_MemoryAllocatorBackend>`
* :ref:`PythonInterpreterProfile <pyembed_enum_PythonInterpreterProfile>`
* :ref:`Allocator <pyembed_enum_Allocator>`
* :ref:`BytecodeOptimizationLevel <pyembed_enum_BytecodeOptimizationLevel>`
* :ref:`BytesWarning <pyembed_enum_BytesWarning>`
* :ref:`CheckHashPycsMode <pyembed_enum_CheckHashPycsMode>`
* :ref:`CoerceCLocale <pyembed_enum_CoerceCLocale>`
* :ref:`MultiprocessingStartMethod <pyembed_enum_MultiprocessingStartMethod>`
* :ref:`TerminfoResolution <pyembed_enum_TerminfoResolution>`

.. _pyembed_struct_OxidizedPythonInterpreterConfig:

``OxidizedPythonInterpreterConfig`` Struct
==========================================

Configuration for a Python interpreter.

This type is used to create a ``crate::MainPythonInterpreter``, which manages
a Python interpreter running in the current process.

This type wraps a ``PythonInterpreterConfig``, which is an abstraction over
the low-level C structs (``PyPreConfig`` and ``PyConfig``) used as part of
Python's C initialization API. In addition to this data structure, the
fields on this type facilitate control of additional features provided by
this crate.

The ``PythonInterpreterConfig`` has a single non-optional field:
``PythonInterpreterConfig::profile``. This defines the defaults for various
fields of the ``PyPreConfig`` and ``PyConfig`` C structs. See
https://docs.python.org/3/c-api/init_config.html#isolated-configuration for
more.

When this type is converted to ``PyPreConfig`` and ``PyConfig``, instances
of these C structs are created from the specified profile. e.g. by calling
``PyPreConfig_InitPythonConfig()``, ``PyPreConfig_InitIsolatedConfig``,
``PyConfig_InitPythonConfig``, and ``PyConfig_InitIsolatedConfig``. Then
for each field in ``PyPreConfig`` and ``PyConfig``, if a corresponding field
on ``PythonInterpreterConfig`` is ``Some``, then the ``PyPreConfig`` or
``PyConfig`` field will be updated accordingly.

During interpreter initialization, ``Self::resolve()`` is called to
resolve/finalize any missing values and convert the instance into a
``ResolvedOxidizedPythonInterpreterConfig``. It is this type that is
used to produce a ``PyPreConfig`` and ``PyConfig``, which are used to
initialize the Python interpreter.

Some fields on this type are redundant or conflict with those on
``PythonInterpreterConfig``. Read the documentation of each field to
understand how they interact. Since ``PythonInterpreterConfig`` is defined
in a different crate, its docs are not aware of the existence of
this crate/type.

This struct implements ``Deserialize`` and ``Serialize`` and therefore can be
serialized to any format supported by the ``serde`` crate. This feature is
used by ``pyoxy`` to allow YAML-based configuration of Python interpreters.


.. _pyembed_struct_OxidizedPythonInterpreterConfig_exe:

``exe`` Field
-------------

The path of the currently executing executable.

This value will always be ``Some`` on ``ResolvedOxidizedPythonInterpreterConfig``
instances.

Default value: ``None``.

``Self::resolve()`` behavior: sets to ``std::env::current_exe()`` if not set.
Will canonicalize the final path, which may entail filesystem I/O.

Type: ``Option<PathBuf>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_origin:

``origin`` Field
----------------

The filesystem path from which relative paths will be interpreted.

This value will always be ``Some`` on ``ResolvedOxidizedPythonInterpreterConfig``
instances.

Default value: ``None``.

``Self::resolve()`` behavior: sets to ``Self::exe.parent()`` if not set.

Type: ``Option<PathBuf>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_interpreter_config:

``interpreter_config`` Field
----------------------------

Low-level configuration of Python interpreter.

Default value: ``PythonInterpreterConfig::default()`` with
``PythonInterpreterConfig::profile`` always set to ``PythonInterpreterProfile::Python``.

``Self::resolve()`` behavior: most fields are copied verbatim.
``PythonInterpreterConfig::module_search_paths`` entries have the special token
``$ORIGIN`` expanded to the resolved value of ``Self::origin``.

Type: ``PythonInterpreterConfig``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_backend:

``allocator_backend`` Field
---------------------------

Memory allocator backend to use.

Default value: ``MemoryAllocatorBackend::Default``.

Interpreter initialization behavior: after ``Py_PreInitialize()`` is called,
``crate::pyalloc::PythonMemoryAllocator::from_backend()`` is called. If this
resolves to a ``crate::pyalloc::PythonMemoryAllocator``, that allocator will
be installed as per ``Self::allocator_raw``, ``Self::allocator_mem``,
``Self::allocator_obj``, and ``Self::allocator_pymalloc_arena``. If a custom
allocator backend is defined but all the ``allocator_*`` flags are ``false``,
the allocator won't be used.

Type: ``MemoryAllocatorBackend``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_raw:

``allocator_raw`` Field
-----------------------

Whether to install the custom allocator for the ``raw`` memory domain.

See https://docs.python.org/3/c-api/memory.html for documentation on how Python
memory allocator domains work.

Default value: ``true``

Interpreter initialization behavior: controls whether ``Self::allocator_backend``
is used for the ``raw`` memory domain.

Has no effect if ``Self::allocator_backend`` is ``MemoryAllocatorBackend::Default``.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_mem:

``allocator_mem`` Field
-----------------------

Whether to install the custom allocator for the ``mem`` memory domain.

See https://docs.python.org/3/c-api/memory.html for documentation on how Python
memory allocator domains work.

Default value: ``false``

Interpreter initialization behavior: controls whether ``Self::allocator_backend``
is used for the ``mem`` memory domain.

Has no effect if ``Self::allocator_backend`` is ``MemoryAllocatorBackend::Default``.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_obj:

``allocator_obj`` Field
-----------------------

Whether to install the custom allocator for the ``obj`` memory domain.

See https://docs.python.org/3/c-api/memory.html for documentation on how Python
memory allocator domains work.

Default value: ``false``

Interpreter initialization behavior: controls whether ``Self::allocator_backend``
is used for the ``obj`` memory domain.

Has no effect if ``Self::allocator_backend`` is ``MemoryAllocatorBackend::Default``.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_pymalloc_arena:

``allocator_pymalloc_arena`` Field
----------------------------------

Whether to install the custom allocator for the ``pymalloc`` arena allocator.

See https://docs.python.org/3/c-api/memory.html for documentation on how Python
memory allocation works.

Default value: ``false``

Interpreter initialization behavior: controls whether ``Self::allocator_backend``
is used for the ``pymalloc`` arena allocator.

This setting requires the ``pymalloc`` allocator to be used for the ``mem``
or ``obj`` domains (``allocator_mem = false`` and ``allocator_obj = false`` - this is
the default behavior) and for ``Self::allocator_backend`` to not be
``MemoryAllocatorBackend::Default``.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_allocator_debug:

``allocator_debug`` Field
-------------------------

Whether to set up Python allocator debug hooks to detect memory bugs.

Default value: ``false``

Interpreter initialization behavior: triggers the calling of
``PyMem_SetupDebugHooks()`` after custom allocators are installed.

This setting can be used with or without custom memory allocators
(see other ``allocator_*`` fields).

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_set_missing_path_configuration:

``set_missing_path_configuration`` Field
----------------------------------------

Whether to automatically set missing "path configuration" fields.

If ``true``, various path configuration
(https://docs.python.org/3/c-api/init_config.html#path-configuration) fields
will be set automatically if their corresponding ``.interpreter_config``
fields are ``None``. For example, ``program_name`` will be set to the current
executable and ``home`` will be set to the executable's directory.

If this is ``false``, the default path configuration built into libpython
is used.

Setting this to ``false`` likely enables isolated interpreters to be used
with "external" Python installs. If this is ``true``, the default isolated
configuration expects files like the Python standard library to be installed
relative to the current executable. You will need to either ensure these
files are present, define ``packed_resources``, and/or set
``.interpreter_config.module_search_paths`` to ensure the interpreter can find
the Python standard library, otherwise the interpreter will fail to start.

Without this set or corresponding ``.interpreter_config`` fields set, you
may also get run-time errors like
``Could not find platform independent libraries <prefix>`` or
``Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]``. If you see
these errors, it means the automatic path config resolutions built into
libpython didn't work because the run-time layout didn't match the
build-time configuration.

Default value: ``true``

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_oxidized_importer:

``oxidized_importer`` Field
---------------------------

Whether to install ``oxidized_importer`` during interpreter initialization.

If ``true``, ``oxidized_importer`` will be imported during interpreter
initialization and an instance of ``oxidized_importer.OxidizedFinder``
will be installed on ``sys.meta_path`` as the first element.

If ``Self::packed_resources`` are defined, they will be loaded into the
``OxidizedFinder``.

If ``Self::filesystem_importer`` is ``true``, its *path hook* will be
registered on ``sys.path_hooks`` so ``PathFinder`` (the standard filesystem
based importer) and ``pkgutil`` can use it.

Default value: ``false``

Interpreter initialization behavior: See above.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_filesystem_importer:

``filesystem_importer`` Field
-----------------------------

Whether to install the path-based finder.

Controls whether to install the Python standard library ``PathFinder`` meta
path finder (this is the meta path finder that loads Python modules and
resources from the filesystem).

Also controls whether to add ``OxidizedFinder``'s path hook to
``sys.path_hooks``.

Due to lack of control over low-level Python interpreter initialization,
the standard library ``PathFinder`` will be registered on ``sys.meta_path``
and ``sys.path_hooks`` for a brief moment when the interpreter is initialized.
If ``sys.path`` contains valid entries that would be serviced by this finder
and ``oxidized_importer`` isn't able to service imports, it is possible for the
path-based finder to be used to import some Python modules needed to initialize
the Python interpreter. In many cases, this behavior is harmless. In all cases,
the path-based importer is removed after Python interpreter initialization, so
future imports won't be serviced by this path-based importer if it is disabled
by this flag.

Default value: ``true``

Interpreter initialization behavior: If false, path-based finders are removed
from ``sys.meta_path`` and ``sys.path_hooks`` is cleared.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_packed_resources:

``packed_resources`` Field
--------------------------

References to packed resources data.

The format of the data is defined by the ``python-packed-resources``
crate. The data will be parsed as part of initializing the custom
meta path importer during interpreter initialization when
``oxidized_importer=true``. If ``oxidized_importer=false``, this field
is ignored.

If paths are relative, that will be evaluated relative to the process's
current working directory following the operating system's standard
path expansion behavior.

Default value: ``vec![]``

``Self::resolve()`` behavior: ``PackedResourcesSource::MemoryMappedPath`` members
have the special string ``$ORIGIN`` expanded to the string value that
``Self::origin`` resolves to.

This field is ignored during serialization.

Type: ``Vec<PackedResourcesSource>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_extra_extension_modules:

``extra_extension_modules`` Field
---------------------------------

Extra extension modules to make available to the interpreter.

The values will effectively be passed to ``PyImport_ExtendInitTab()``.

Default value: ``None``

Interpreter initialization behavior: ``PyImport_Inittab`` will be extended
with entries from this list. This makes the extensions available as
built-in extension modules.

This field is ignored during serialization.

Type: ``Option<Vec<ExtensionModule>>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_argv:

``argv`` Field
--------------

Command line arguments to initialize ``sys.argv`` with.

Default value: ``None``

``Self::resolve()`` behavior: ``Some`` value is used if set. Otherwise
``PythonInterpreterConfig::argv`` is used if set. Otherwise
``std::env::args_os()`` is called.

Interpreter initialization behavior: the resolved ``Some`` value is used
to populate ``PyConfig.argv``.

Type: ``Option<Vec<OsString>>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_argvb:

``argvb`` Field
---------------

Whether to set ``sys.argvb`` with bytes versions of process arguments.

On Windows, bytes will be UTF-16. On POSIX, bytes will be raw char*
values passed to ``int main()``.

Enabling this feature will give Python applications access to the raw
``bytes`` values of raw argument data passed into the executable. The single
or double width bytes nature of the data is preserved.

Unlike ``sys.argv`` which may chomp off leading argument depending on the
Python execution mode, ``sys.argvb`` has all the arguments used to initialize
the process. i.e. the first argument is always the executable.

Default value: ``false``

Interpreter initialization behavior: ``sys.argvb`` will be set to a
``list[bytes]``. ``sys.argv`` and ``sys.argvb`` should have the same number
of elements.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_multiprocessing_auto_dispatch:

``multiprocessing_auto_dispatch`` Field
---------------------------------------

Automatically detect and run in ``multiprocessing`` mode.

If set, ``crate::MainPythonInterpreter::run()`` will detect when the invoked
interpreter looks like it is supposed to be a ``multiprocessing`` worker and
will automatically call into the ``multiprocessing`` module instead of running
the configured code.

Enabling this has the same effect as calling ``multiprocessing.freeze_support()``
in your application code's ``__main__`` and replaces the need to do so.

Default value: ``true``

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_multiprocessing_start_method:

``multiprocessing_start_method`` Field
--------------------------------------

Controls how to call ``multiprocessing.set_start_method()``.

Default value: ``MultiprocessingStartMethod::Auto``

Interpreter initialization behavior: if ``Self::oxidized_importer`` is ``true``,
the ``OxidizedImporter`` will be taught to call ``multiprocessing.set_start_method()``
when ``multiprocessing`` is imported. If ``false``, this value has no effect.

Type: ``MultiprocessingStartMethod``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_sys_frozen:

``sys_frozen`` Field
--------------------

Whether to set sys.frozen=True.

Setting this will enable Python to emulate "frozen" binaries, such as
those used by PyInstaller.

Default value: ``false``

Interpreter initialization behavior: If ``true``, ``sys.frozen = True``.
If ``false``, ``sys.frozen`` is not defined.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_sys_meipass:

``sys_meipass`` Field
---------------------

Whether to set sys._MEIPASS to the directory of the executable.

Setting this will enable Python to emulate PyInstaller's behavior
of setting this attribute. This could potentially help with self-contained
application compatibility by masquerading as PyInstaller and causing code
to activate *PyInstaller mode*.

Default value: ``false``

Interpreter initialization behavior: If ``true``, ``sys._MEIPASS`` will
be set to a ``str`` holding the value of ``Self::origin``. If ``false``,
``sys._MEIPASS`` will not be defined.

Type: ``bool``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_terminfo_resolution:

``terminfo_resolution`` Field
-----------------------------

How to resolve the ``terminfo`` database.

Default value: ``TerminfoResolution::Dynamic``

Interpreter initialization behavior: the ``TERMINFO_DIRS`` environment
variable may be set for this process depending on what ``TerminfoResolution``
instructs to do.

``terminfo`` is not used on Windows and this setting is ignored on that
platform.

Type: ``TerminfoResolution``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_tcl_library:

``tcl_library`` Field
---------------------

Path to use to define the ``TCL_LIBRARY`` environment variable.

This directory should contain an ``init.tcl`` file. It is commonly
a directory named ``tclX.Y``. e.g. ``tcl8.6``.

Default value: ``None``

``Self::resolve()`` behavior: the token ``$ORIGIN`` is expanded to the
resolved value of ``Self::origin``.

Interpreter initialization behavior: if set, the ``TCL_LIBRARY`` environment
variable will be set for the current process.

Type: ``Option<PathBuf>``

.. _pyembed_struct_OxidizedPythonInterpreterConfig_write_modules_directory_env:

``write_modules_directory_env`` Field
-------------------------------------

Environment variable holding the directory to write a loaded modules file.

If this value is set and the environment it refers to is set,
on interpreter shutdown, we will write a ``modules-<random>`` file to
the directory specified containing a ``\n`` delimited list of modules
loaded in ``sys.modules``.

This setting is useful to record which modules are loaded during the execution
of a Python interpreter.

Default value: ``None``

Type: ``Option<String>``


.. _pyembed_struct_PythonInterpreterConfig:

``PythonInterpreterConfig`` Struct
==================================

Holds configuration of a Python interpreter.

This struct holds fields that are exposed by ``PyPreConfig`` and
``PyConfig`` in the CPython API.

Other than the profile (which is used to initialize instances of
``PyPreConfig`` and ``PyConfig``), all fields are optional. Only fields
with ``Some(T)`` will be updated from the defaults.


.. _pyembed_struct_PythonInterpreterConfig_profile:

``profile`` Field
-----------------

Profile to use to initialize pre-config and config state of interpreter.

Type: ``PythonInterpreterProfile``

.. _pyembed_struct_PythonInterpreterConfig_allocator:

``allocator`` Field
-------------------

Name of the memory allocator.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.allocator.

Type: ``Option<Allocator>``

.. _pyembed_struct_PythonInterpreterConfig_configure_locale:

``configure_locale`` Field
--------------------------

Whether to set the LC_CTYPE locale to the user preferred locale.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.configure_locale.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_coerce_c_locale:

``coerce_c_locale`` Field
-------------------------

How to coerce the locale settings.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.coerce_c_locale.

Type: ``Option<CoerceCLocale>``

.. _pyembed_struct_PythonInterpreterConfig_coerce_c_locale_warn:

``coerce_c_locale_warn`` Field
------------------------------

Whether to emit a warning if the C locale is coerced.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.coerce_c_locale_warn.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_development_mode:

``development_mode`` Field
--------------------------

Whether to enable Python development mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.dev_mode.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_isolated:

``isolated`` Field
------------------

Isolated mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.isolated.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_legacy_windows_fs_encoding:

``legacy_windows_fs_encoding`` Field
------------------------------------

Whether to use legacy filesystem encodings on Windows.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_parse_argv:

``parse_argv`` Field
--------------------

Whether argv should be parsed the way ``python`` parses them.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.parse_argv.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_use_environment:

``use_environment`` Field
-------------------------

Whether environment variables are read to control the interpreter configuration.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.use_environment.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_utf8_mode:

``utf8_mode`` Field
-------------------

Controls Python UTF-8 mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.utf8_mode.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_argv:

``argv`` Field
--------------

Command line arguments.

These will become ``sys.argv``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.argv.

Type: ``Option<Vec<OsString>>``

.. _pyembed_struct_PythonInterpreterConfig_base_exec_prefix:

``base_exec_prefix`` Field
--------------------------

Controls ``sys.base_exec_prefix``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_exec_prefix.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_base_executable:

``base_executable`` Field
-------------------------

Controls ``sys._base_executable``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_executable.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_base_prefix:

``base_prefix`` Field
---------------------

Controls ``sys.base_prefix``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_prefix.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_buffered_stdio:

``buffered_stdio`` Field
------------------------

Controls buffering on ``stdout`` and ``stderr``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.buffered_stdio.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_bytes_warning:

``bytes_warning`` Field
-----------------------

Controls warnings/errors for some bytes type coercions.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.bytes_warning.

Type: ``Option<BytesWarning>``

.. _pyembed_struct_PythonInterpreterConfig_check_hash_pycs_mode:

``check_hash_pycs_mode`` Field
------------------------------

Validation mode for ``.pyc`` files.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.check_hash_pycs_mode.

Type: ``Option<CheckHashPycsMode>``

.. _pyembed_struct_PythonInterpreterConfig_configure_c_stdio:

``configure_c_stdio`` Field
---------------------------

Controls binary mode and buffering on C standard streams.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.configure_c_stdio.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_dump_refs:

``dump_refs`` Field
-------------------

Dump Python references.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.dump_refs.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_exec_prefix:

``exec_prefix`` Field
---------------------

Controls ``sys.exec_prefix``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.exec_prefix.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_executable:

``executable`` Field
--------------------

Controls ``sys.executable``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.executable.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_fault_handler:

``fault_handler`` Field
-----------------------

Enable ``faulthandler``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.faulthandler.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_filesystem_encoding:

``filesystem_encoding`` Field
-----------------------------

Controls the encoding to use for filesystems/paths.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.filesystem_encoding.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_filesystem_errors:

``filesystem_errors`` Field
---------------------------

Filesystem encoding error handler.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.filesystem_errors.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_hash_seed:

``hash_seed`` Field
-------------------

Randomized hash function seed.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.hash_seed.

Type: ``Option<c_ulong>``

.. _pyembed_struct_PythonInterpreterConfig_home:

``home`` Field
--------------

Python home directory.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.home.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_import_time:

``import_time`` Field
---------------------

Whether to profile ``import`` time.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.import_time.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_inspect:

``inspect`` Field
-----------------

Enter interactive mode after executing a script or a command.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.inspect.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_install_signal_handlers:

``install_signal_handlers`` Field
---------------------------------

Whether to install Python signal handlers.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.install_signal_handlers.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_interactive:

``interactive`` Field
---------------------

Whether to enable the interactive REPL mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.interactive.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_legacy_windows_stdio:

``legacy_windows_stdio`` Field
------------------------------

Controls legacy stdio behavior on Windows.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.legacy_windows_stdio.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_malloc_stats:

``malloc_stats`` Field
----------------------

Whether to dump statistics from the ``pymalloc`` allocator on exit.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.malloc_stats.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_module_search_paths:

``module_search_paths`` Field
-----------------------------

Defines ``sys.path``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.module_search_paths.

This value effectively controls the initial value of ``sys.path``.

The special string ``$ORIGIN`` in values will be expanded to the absolute path of the
directory of the executable at run-time. For example, if the executable is
``/opt/my-application/pyapp``, ``$ORIGIN`` will expand to ``/opt/my-application`` and the
value ``$ORIGIN/lib`` will expand to ``/opt/my-application/lib``.

Type: ``Option<Vec<PathBuf>>``

.. _pyembed_struct_PythonInterpreterConfig_optimization_level:

``optimization_level`` Field
----------------------------

Bytecode optimization level.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.optimization_level.

This setting is only relevant if ``write_bytecode`` is true and Python modules are
being imported from the filesystem using Python’s standard filesystem importer.

Type: ``Option<BytecodeOptimizationLevel>``

.. _pyembed_struct_PythonInterpreterConfig_parser_debug:

``parser_debug`` Field
----------------------

Parser debug mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.parser_debug.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_pathconfig_warnings:

``pathconfig_warnings`` Field
-----------------------------

Whether calculating the Python path configuration can emit warnings.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.pathconfig_warnings.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_prefix:

``prefix`` Field
----------------

Defines ``sys.prefix``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.prefix.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_program_name:

``program_name`` Field
----------------------

Program named used to initialize state during path configuration.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.program_name.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_pycache_prefix:

``pycache_prefix`` Field
------------------------

Directory where ``.pyc`` files are written.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.pycache_prefix.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_python_path_env:

``python_path_env`` Field
-------------------------

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.pythonpath_env.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_quiet:

``quiet`` Field
---------------

Quiet mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.quiet.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_run_command:

``run_command`` Field
---------------------

Value of the ``-c`` command line option.

Effectively defines Python code to evaluate in ``Py_RunMain()``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.run_command.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_run_filename:

``run_filename`` Field
----------------------

Filename passed on the command line.

Effectively defines the Python file to run in ``Py_RunMain()``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.run_filename.

Type: ``Option<PathBuf>``

.. _pyembed_struct_PythonInterpreterConfig_run_module:

``run_module`` Field
--------------------

Value of the ``-m`` command line option.

Effectively defines the Python module to run as ``__main__`` in ``Py_RunMain()``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.run_module.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_show_ref_count:

``show_ref_count`` Field
------------------------

Whether to show the total reference count at exit.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.show_ref_count.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_site_import:

``site_import`` Field
---------------------

Whether to import the ``site`` module at startup.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.site_import.

The ``site`` module is typically not needed for standalone applications and disabling
it can reduce application startup time.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_skip_first_source_line:

``skip_first_source_line`` Field
--------------------------------

Whether to skip the first line of ``Self::run_filename``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.skip_source_first_line.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_stdio_encoding:

``stdio_encoding`` Field
------------------------

Encoding of ``sys.stdout``, ``sys.stderr``, and ``sys.stdin``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.stdio_encoding.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_stdio_errors:

``stdio_errors`` Field
----------------------

Encoding error handler for ``sys.stdout`` and ``sys.stdin``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.stdio_errors.

Type: ``Option<String>``

.. _pyembed_struct_PythonInterpreterConfig_tracemalloc:

``tracemalloc`` Field
---------------------

Whether to enable ``tracemalloc``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.tracemalloc.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_user_site_directory:

``user_site_directory`` Field
-----------------------------

Whether to add the user site directory to ``sys.path``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.user_site_directory.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_verbose:

``verbose`` Field
-----------------

Verbose mode.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.verbose.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_warn_options:

``warn_options`` Field
----------------------

Options of the ``warning`` module to control behavior.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.warnoptions.

Type: ``Option<Vec<String>>``

.. _pyembed_struct_PythonInterpreterConfig_write_bytecode:

``write_bytecode`` Field
------------------------

Controls ``sys.dont_write_bytecode``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.write_bytecode.

Type: ``Option<bool>``

.. _pyembed_struct_PythonInterpreterConfig_x_options:

``x_options`` Field
-------------------

Values of the ``-X`` command line options / ``sys._xoptions``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.xoptions.

Type: ``Option<Vec<String>>``


.. _pyembed_enum_MemoryAllocatorBackend:

``MemoryAllocatorBackend`` Enum
===============================

Defines a backend for a memory allocator.

This says which memory allocator API / library to configure the Python
interpreter to use.

Not all allocators are available in all program builds.

Serialization type: ``string``


``Default`` Variant
   The default allocator as configured by Python.
   
   This likely utilizes the system default allocator, normally the
   ``malloc()``, ``free()``, etc functions from the libc implementation being
   linked against.
   
   Serialized value: ``default``
   

``Jemalloc`` Variant
   Use the jemalloc allocator.
   
   Requires the binary to be built with jemalloc support.
   
   Never available on Windows.
   
   Serialized value: ``jemalloc``
   

``Mimalloc`` Variant
   Use the mimalloc allocator (https://github.com/microsoft/mimalloc).
   
   Requires the binary to be built with mimalloc support.
   
   Serialized value: ``mimalloc``
   

``Snmalloc`` Variant
   Use the snmalloc allocator (https://github.com/microsoft/snmalloc).
   
   Not always available.
   
   Serialized value: ``snmalloc``
   

``Rust`` Variant
   Use Rust's global allocator.
   
   The Rust allocator is less efficient than other allocators because of
   overhead tracking allocations. For optimal performance, use the default
   allocator. Or if Rust is using a custom global allocator, use the enum
   variant corresponding to that allocator.
   
   Serialized value: ``rust``
   


.. _pyembed_enum_PythonInterpreterProfile:

``PythonInterpreterProfile`` Enum
=================================

Defines the profile to use to configure a Python interpreter.

This effectively provides a template for seeding the initial values of
``PyPreConfig`` and ``PyConfig`` C structs.

Serialization type: ``string``.


``Isolated`` Variant
   Python is isolated from the system.
   
   See https://docs.python.org/3/c-api/init_config.html#isolated-configuration.
   
   Serialized value: ``isolated``
   

``Python`` Variant
   Python interpreter behaves like ``python``.
   
   See https://docs.python.org/3/c-api/init_config.html#python-configuration.
   
   Serialized value: ``python``
   


.. _pyembed_enum_Allocator:

``Allocator`` Enum
==================

Name of the Python memory allocators.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.allocator.

Serialization type: ``string``


``NotSet`` Variant
   Don’t change memory allocators (use defaults).
   
   Serialized value: ``not-set``
   

``Default`` Variant
   Default memory allocators.
   
   Serialized value: ``default``
   

``Debug`` Variant
   Default memory allocators with debug hooks.
   
   Serialized value: ``debug``
   

``Malloc`` Variant
   Use ``malloc()`` from the C library.
   
   Serialized value: ``malloc``
   

``MallocDebug`` Variant
   Force usage of ``malloc()`` with debug hooks.
   
   Serialized value: ``malloc-debug``
   

``PyMalloc`` Variant
   Python ``pymalloc`` allocator.
   
   Serialized value: ``py-malloc``
   

``PyMallocDebug`` Variant
   Python ``pymalloc`` allocator with debug hooks.
   
   Serialized value: ``py-malloc-debug``
   


.. _pyembed_enum_BytecodeOptimizationLevel:

``BytecodeOptimizationLevel`` Enum
==================================

An optimization level for Python bytecode.

Serialization type: ``int``


``Zero`` Variant
   Optimization level 0.
   
   Serialized value: ``0``
   

``One`` Variant
   Optimization level 1.
   
   Serialized value: ``1``
   

``Two`` Variant
   Optimization level 2.
   
   Serialized value: ``2``
   


.. _pyembed_enum_BytesWarning:

``BytesWarning`` Enum
=====================

Defines what to do when comparing ``bytes`` or ``bytesarray`` with ``str`` or comparing ``bytes`` with ``int``.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.bytes_warning.

Serialization type: ``string``


``None`` Variant
   Do nothing.
   
   Serialization value: ``none``
   

``Warn`` Variant
   Issue a warning.
   
   Serialization value: ``warn``
   

``Raise`` Variant
   Raise a ``BytesWarning``.
   
   Serialization value: ``raise``
   


.. _pyembed_enum_CheckHashPycsMode:

``CheckHashPycsMode`` Enum
==========================

Control the validation behavior of hash-based .pyc files.

See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.check_hash_pycs_mode.

Serialization type: ``string``


``Always`` Variant
   Hash the source file for invalidation regardless of value of the ``check_source`` flag.
   
   Serialized value: ``always``
   

``Never`` Variant
   Assume that hash-based pycs always are valid.
   
   Serialized value: ``never``
   

``Default`` Variant
   The ``check_source`` flag in hash-based pycs determines invalidation.
   
   Serialized value: ``default``
   


.. _pyembed_enum_CoerceCLocale:

``CoerceCLocale`` Enum
======================

Holds values for ``coerce_c_locale``.

See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.coerce_c_locale.

Serialization type: ``string``


``LCCtype`` Variant
   Read the LC_CTYPE locale to decide if it should be coerced.
   
   Serialized value: ``LC_CTYPE``
   

``C`` Variant
   Coerce the C locale.
   
   Serialized value: ``C``
   


.. _pyembed_enum_MultiprocessingStartMethod:

``MultiprocessingStartMethod`` Enum
===================================

Defines how to call ``multiprocessing.set_start_method()`` when ``multiprocessing`` is imported.

When set to a value that is not ``none``, when ``oxidized_importer.OxidizedFinder`` services
an import of the ``multiprocessing`` module, it will automatically call
``multiprocessing.set_start_method()`` to configure how worker processes are created.

If the ``multiprocessing`` module is not imported by ``oxidized_importer.OxidizedFinder``,
this setting has no effect.

Serialization type: ``string``


``None`` Variant
   Do not call ``multiprocessing.set_start_method()``.
   
   This mode is what Python programs do by default.
   
   Serialized value: ``none``
   

``Fork`` Variant
   Call with value ``fork``.
   
   Serialized value: ``fork``
   

``ForkServer`` Variant
   Call with value ``forkserver``
   
   Serialized value: ``forkserver``
   

``Spawn`` Variant
   Call with value ``spawn``
   
   Serialized value: ``spawn``
   

``Auto`` Variant
   Call with a valid appropriate for the given environment.
   
   This likely maps to ``spawn`` on Windows and ``fork`` on non-Windows.
   
   Serialized value: ``auto``
   


.. _pyembed_enum_TerminfoResolution:

``TerminfoResolution`` Enum
===========================

Defines ``terminfo`` database resolution semantics.

Python links against libraries like ``readline``, ``libedit``, and ``ncurses``
which need to utilize a ``terminfo`` database (a set of files defining
terminals and their capabilities) in order to work properly.

The absolute path to the terminfo database is typically compiled into these
libraries at build time. If the compiled path on the building machine doesn't
match the path on the runtime machine, these libraries cannot find the terminfo
database and terminal interactions won't work correctly because these libraries
don't know how to resolve terminal features. This can result in quirks like
the backspace key not working in prompts.

The ``pyembed`` Rust crate is able to point libraries at a terminfo database
at runtime, overriding the compiled-in default path. This enum is used
to control that behavior.

Serialization type: ``string``.


``Dynamic`` Variant
   Resolve ``terminfo`` database using appropriate behavior for current OS.
   
   We will look for the terminfo database in paths that are common for the
   current OS / distribution. The terminfo database is present in most systems
   (except the most barebones containers or sandboxes) and this method is
   usually successfully in locating the terminfo database.
   
   Serialized value: ``dynamic``
   

``None`` Variant
   Do not attempt to resolve the ``terminfo`` database. Basically a no-op.
   
   This is what should be used for applications that don't interact with the
   terminal. Using this option will prevent some I/O syscalls that would
   be incurred by ``dynamic``.
   
   Serialized value: ``none``
   

``Static`` Variant
   Use a specified string as the ``TERMINFO_DIRS`` value.
   
   Serialized value: ``static:<path>``
   
   e.g. ``static:/usr/share/terminfo``.