pub struct PythonInterpreterConfig {
Show 56 fields pub profile: PythonInterpreterProfile, pub allocator: Option<Allocator>, pub configure_locale: Option<bool>, pub coerce_c_locale: Option<CoerceCLocale>, pub coerce_c_locale_warn: Option<bool>, pub development_mode: Option<bool>, pub isolated: Option<bool>, pub legacy_windows_fs_encoding: Option<bool>, pub parse_argv: Option<bool>, pub use_environment: Option<bool>, pub utf8_mode: Option<bool>, pub argv: Option<Vec<OsString, Global>>, pub base_exec_prefix: Option<PathBuf>, pub base_executable: Option<PathBuf>, pub base_prefix: Option<PathBuf>, pub buffered_stdio: Option<bool>, pub bytes_warning: Option<BytesWarning>, pub check_hash_pycs_mode: Option<CheckHashPycsMode>, pub configure_c_stdio: Option<bool>, pub dump_refs: Option<bool>, pub exec_prefix: Option<PathBuf>, pub executable: Option<PathBuf>, pub fault_handler: Option<bool>, pub filesystem_encoding: Option<String>, pub filesystem_errors: Option<String>, pub hash_seed: Option<u64>, pub home: Option<PathBuf>, pub import_time: Option<bool>, pub inspect: Option<bool>, pub install_signal_handlers: Option<bool>, pub interactive: Option<bool>, pub legacy_windows_stdio: Option<bool>, pub malloc_stats: Option<bool>, pub module_search_paths: Option<Vec<PathBuf, Global>>, pub optimization_level: Option<BytecodeOptimizationLevel>, pub parser_debug: Option<bool>, pub pathconfig_warnings: Option<bool>, pub prefix: Option<PathBuf>, pub program_name: Option<PathBuf>, pub pycache_prefix: Option<PathBuf>, pub python_path_env: Option<String>, pub quiet: Option<bool>, pub run_command: Option<String>, pub run_filename: Option<PathBuf>, pub run_module: Option<String>, pub show_ref_count: Option<bool>, pub site_import: Option<bool>, pub skip_first_source_line: Option<bool>, pub stdio_encoding: Option<String>, pub stdio_errors: Option<String>, pub tracemalloc: Option<bool>, pub user_site_directory: Option<bool>, pub verbose: Option<bool>, pub warn_options: Option<Vec<String, Global>>, pub write_bytecode: Option<bool>, pub x_options: Option<Vec<String, Global>>,
}
Expand description

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.

Fields§

§profile: PythonInterpreterProfile

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

§allocator: Option<Allocator>§configure_locale: Option<bool>

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.

§coerce_c_locale: Option<CoerceCLocale>§coerce_c_locale_warn: Option<bool>

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.

§development_mode: Option<bool>

Whether to enable Python development mode.

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

§isolated: Option<bool>§legacy_windows_fs_encoding: Option<bool>

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.

§parse_argv: Option<bool>

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.

§use_environment: Option<bool>

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.

§utf8_mode: Option<bool>§argv: Option<Vec<OsString, Global>>

Command line arguments.

These will become sys.argv.

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

§base_exec_prefix: Option<PathBuf>§base_executable: Option<PathBuf>§base_prefix: Option<PathBuf>§buffered_stdio: Option<bool>§bytes_warning: Option<BytesWarning>

Controls warnings/errors for some bytes type coercions.

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

§check_hash_pycs_mode: Option<CheckHashPycsMode>§configure_c_stdio: Option<bool>

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.

§dump_refs: Option<bool>§exec_prefix: Option<PathBuf>§executable: Option<PathBuf>§fault_handler: Option<bool>§filesystem_encoding: Option<String>

Controls the encoding to use for filesystems/paths.

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

§filesystem_errors: Option<String>§hash_seed: Option<u64>§home: Option<PathBuf>§import_time: Option<bool>§inspect: Option<bool>

Enter interactive mode after executing a script or a command.

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

§install_signal_handlers: Option<bool>§interactive: Option<bool>

Whether to enable the interactive REPL mode.

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

§legacy_windows_stdio: Option<bool>§malloc_stats: Option<bool>

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.

§module_search_paths: Option<Vec<PathBuf, Global>>

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.

§optimization_level: Option<BytecodeOptimizationLevel>

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.

§parser_debug: Option<bool>§pathconfig_warnings: Option<bool>

Whether calculating the Python path configuration can emit warnings.

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

§prefix: Option<PathBuf>§program_name: Option<PathBuf>

Program named used to initialize state during path configuration.

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

§pycache_prefix: Option<PathBuf>§python_path_env: Option<String>§quiet: Option<bool>§run_command: Option<String>

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.

§run_filename: Option<PathBuf>

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.

§run_module: Option<String>

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.

§show_ref_count: Option<bool>

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.

§site_import: Option<bool>

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.

§skip_first_source_line: Option<bool>§stdio_encoding: Option<String>

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

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

§stdio_errors: Option<String>

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

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

§tracemalloc: Option<bool>§user_site_directory: Option<bool>

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.

§verbose: Option<bool>§warn_options: Option<Vec<String, Global>>

Options of the warning module to control behavior.

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

§write_bytecode: Option<bool>§x_options: Option<Vec<String, Global>>

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

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

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.