hpcflow.sdk.runtime.RunTimeInfo#

class hpcflow.sdk.runtime.RunTimeInfo(name, package_name, version, logger)#

Bases: object

Get useful run-time information, including the executable name used to invoke the CLI, in the case a PyInstaller-built executable was used.

Parameters:
  • name (str) – Application name.

  • package_name (str) – Application package name.

  • version (str) – Application version.

  • logger (Logger) – Where to write logging versions.

Methods

get_activate_env_command

Get the command to activate the virtual environment.

get_deactivate_env_command

Get the command to deactivate the virtual environment.

show

Display the information known by this class as a human-readable table.

to_dict

Serialize this class as a dictionary.

Attributes

executable_name

Get the name of the frozen app executable, if the app is frozen.

executable_path

Get the path that the user invoked to launch the frozen app, if the app is frozen.

invocation_command

Get the command that was used to invoke this instance of the app.

resolved_executable_name

Get the resolved name of the frozen app executable, if the app is frozen.

resolved_executable_path

Get the resolved path to the frozen app that the user launched, if the app is frozen.

resolved_script_path

Get the resolved path to the Python script used to invoked this instance of the app, if the app is not frozen.

script_path

Get the path to the Python script used to invoked this instance of the app, if the app is not frozen.

name

Application name.

package_name

Application package name.

version

Application version.

is_frozen

Whether this is a frozen application.

working_dir

Working directory.

logger

Where to write log messages.

hostname

Host that this is running on.

in_ipython

Whether this application is inside iPython.

is_interactive

Whether this application is being used interactively.

in_pytest

Whether this application is being used in test mode.

from_CLI

Whether this application is being run from the CLI.

bundle_dir

The bundle directory, if frozen.

python_executable_path

The path to Python itself.

python_version

The Python version.

is_venv

Whether the application is in a virtual environment.

is_conda_venv

Whether the application is in a Conda virtual environment.

sys_prefix

From sys.prefix.

sys_base_prefix

From sys.base_prefix.

sys_real_prefix

The old base prefix, from sys.real_prefix.

conda_prefix

The Conda prefix, if defined.

venv_path

The virtual environment path.

bundle_dir#

The bundle directory, if frozen.

conda_prefix#

The Conda prefix, if defined.

property executable_name: str | None#

Get the name of the frozen app executable, if the app is frozen.

If the user launches the app via a symbolic link, then this returns the name of that link, whereas resolved_executable_name returns the actual frozen app file name.

property executable_path: Path | None#

Get the path that the user invoked to launch the frozen app, if the app is frozen.

If the user launches the app via a symbolic link, then this returns that link, whereas executable_path_resolved returns the actual frozen app path.

from_CLI#

Whether this application is being run from the CLI.

get_activate_env_command()#

Get the command to activate the virtual environment.

get_deactivate_env_command()#

Get the command to deactivate the virtual environment.

hostname#

Host that this is running on.

in_ipython#

Whether this application is inside iPython.

in_pytest#

Whether this application is being used in test mode.

property invocation_command: tuple[str, ...]#

Get the command that was used to invoke this instance of the app.

is_conda_venv#

Whether the application is in a Conda virtual environment.

is_frozen#

Whether this is a frozen application.

is_interactive#

Whether this application is being used interactively.

is_venv#

Whether the application is in a virtual environment.

logger#

Where to write log messages.

name#

Application name.

package_name#

Application package name.

python_executable_path#

The path to Python itself.

python_version#

The Python version.

property resolved_executable_name: str | None#

Get the resolved name of the frozen app executable, if the app is frozen.

property resolved_executable_path: Path | None#

Get the resolved path to the frozen app that the user launched, if the app is frozen.

In a one-file app, this is the path to the bootloader. In the one-folder app, this is the path to the executable.

References

[1] https://pyinstaller.org/en/stable/runtime-information.html#using-sys-executable-and-sys-argv-0

property resolved_script_path: Path | None#

Get the resolved path to the Python script used to invoked this instance of the app, if the app is not frozen.

property script_path: Path | None#

Get the path to the Python script used to invoked this instance of the app, if the app is not frozen.

show()#

Display the information known by this class as a human-readable table.

Return type:

None

sys_base_prefix#

From sys.base_prefix. This will be equal to sys_prefix (sys.prefix) if not running within a virtual environment. However, if running within a virtual environment, this will be the Python installation directory, and sys_prefix will be equal to the virtual environment directory.

sys_prefix#

From sys.prefix. If running in a virtual environment, this will point to the environment directory. If not running in a virtual environment, this will point to the Python installation root.

sys_real_prefix#

The old base prefix, from sys.real_prefix. Compatibility version of sys_base_prefix.

to_dict()#

Serialize this class as a dictionary.

Return type:

dict[str, Any]

venv_path: str | list[str] | None#

The virtual environment path.

version#

Application version.

working_dir#

Working directory.