PythonInitializer
QuantConnect.Python.PythonInitializer
Bases: Object
Helper class for Python initialization
activate_python_virtual_environment
activate_python_virtual_environment(
path_to_virtual_env: str,
) -> bool
"Activate" a virtual Python environment by prepending its library storage to Pythons path. This allows the libraries in this venv to be selected prior to our base install. Requires PYTHONNET_PYDLL to be set to base install.
add_algorithm_location_path
add_algorithm_location_path(
algorithm_location: str,
) -> None
Adds the algorithm location to the python path. This will make sure that add_python_paths keeps the algorithm location path at the beginning of the pythonpath.
add_python_paths
add_python_paths(paths: List[str]) -> bool
Adds directories to the python path at runtime
initialize
initialize(begin_allow_threads: bool = True) -> None
Initialize python.
In some cases, we might not need to call BeginAllowThreads, like when we're running in a python or non-threaded environment. In those cases, we can set the begin_allow_threads parameter to false.
reset_algorithm_location_path
reset_algorithm_location_path() -> None
Resets the algorithm location path so another can be set
shutdown
shutdown() -> None
Shutdown python