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>>,
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>>,
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>>,
pub write_bytecode: Option<bool>,
pub x_options: Option<Vec<String>>,
}
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>
Name of the memory allocator.
See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.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>
How to coerce the locale settings.
See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.coerce_c_locale.
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>
Isolated mode.
See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.isolated.
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>
Controls Python UTF-8 mode.
See https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig.utf8_mode.
argv: Option<Vec<OsString>>
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>
Controls sys.base_exec_prefix
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_exec_prefix.
base_executable: Option<PathBuf>
Controls sys._base_executable
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_executable.
base_prefix: Option<PathBuf>
Controls sys.base_prefix
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.base_prefix.
buffered_stdio: Option<bool>
Controls buffering on stdout
and stderr
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.buffered_stdio.
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>
Validation mode for .pyc
files.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.check_hash_pycs_mode.
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>
Dump Python references.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.dump_refs.
exec_prefix: Option<PathBuf>
Controls sys.exec_prefix
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.exec_prefix.
executable: Option<PathBuf>
Controls sys.executable
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.executable.
fault_handler: Option<bool>
Enable faulthandler
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.faulthandler.
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>
Filesystem encoding error handler.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.filesystem_errors.
hash_seed: Option<u64>
Randomized hash function seed.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.hash_seed.
home: Option<PathBuf>
Python home directory.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.home.
import_time: Option<bool>
Whether to profile import
time.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.import_time.
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>
Whether to install Python signal handlers.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.install_signal_handlers.
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>
Controls legacy stdio behavior on Windows.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.legacy_windows_stdio.
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>>
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>
Parser debug mode.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.parser_debug.
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>
Defines sys.prefix
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.prefix.
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>
Directory where .pyc
files are written.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.pycache_prefix.
python_path_env: Option<String>
§quiet: Option<bool>
Quiet mode.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.quiet.
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>
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.
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>
Whether to enable tracemalloc
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.tracemalloc.
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>
Verbose mode.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.verbose.
warn_options: Option<Vec<String>>
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>
Controls sys.dont_write_bytecode
.
See https://docs.python.org/3/c-api/init_config.html#c.PyConfig.write_bytecode.
x_options: Option<Vec<String>>
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§
Source§impl Clone for PythonInterpreterConfig
impl Clone for PythonInterpreterConfig
Source§fn clone(&self) -> PythonInterpreterConfig
fn clone(&self) -> PythonInterpreterConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PythonInterpreterConfig
impl Debug for PythonInterpreterConfig
Source§impl Default for PythonInterpreterConfig
impl Default for PythonInterpreterConfig
Source§fn default() -> PythonInterpreterConfig
fn default() -> PythonInterpreterConfig
Source§impl PartialEq for PythonInterpreterConfig
impl PartialEq for PythonInterpreterConfig
impl Eq for PythonInterpreterConfig
impl StructuralPartialEq for PythonInterpreterConfig
Auto Trait Implementations§
impl Freeze for PythonInterpreterConfig
impl RefUnwindSafe for PythonInterpreterConfig
impl Send for PythonInterpreterConfig
impl Sync for PythonInterpreterConfig
impl Unpin for PythonInterpreterConfig
impl UnwindSafe for PythonInterpreterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more