sys_arch()

def sys_arch() -> string

Returns the current CPU architecture.

Returns the architecture identifier for the CPU (e.g., “x86_64”, “aarch64”, “arm”, “wasm32”). Useful for selecting architecture-specific binaries or libraries.

Returns

str: The CPU architecture identifier (“x86_64”, “aarch64”, “arm”, “wasm32”, etc.)

sys_cpu_count()

def sys_cpu_count() -> int

Returns the logical CPU count of the system.

Returns the number of logical CPU cores available. This is the number of concurrent threads the system can run. Useful for parallelization decisions.

Returns

int: The number of logical CPU cores

sys_endianness()

def sys_endianness() -> string

Returns the byte order (endianness) of the system.

Returns either “little” or “big” to indicate whether the system uses little-endian or big-endian byte order. Most modern systems are little-endian.

Returns

str: Either “little” or “big”

sys_executable()

def sys_executable() -> string

Returns the path to the current executable.

Gets the absolute path to the currently running executable file (the spaces interpreter, or the binary running the Starlark script). Useful for spawning child processes, self-location, and relative path resolution.

Raises: Error: If executable path cannot be determined (rare)

Returns

str: Absolute path to the current executable

sys_exit()

def sys_exit(code) -> NoneType

Exits the program with the specified exit code.

Terminates the current process immediately with the given exit code. Use 0 for successful termination and non-zero values (typically 1) to indicate errors. This function does not return; the process is terminated.

Args

  • code: int: Exit code to use (default: 0 for success). Use non-zero values to indicate error conditions to the calling environment.

sys_hostname()

def sys_hostname() -> string

Returns the hostname of the current machine.

Gets the hostname as reported by the operating system. Useful for logging, identifying which machine performed an action, or machine-specific configuration.

Raises: Error: If hostname cannot be determined (rare, usually succeeds)

Returns

str: The hostname of the machine

sys_info()

def sys_info() -> dict

Returns a dictionary with all available system information.

Gathers and returns a comprehensive snapshot of system information in a single convenient dictionary. Useful for logging, debugging, and configuration.

Returns

dict: Dictionary containing all system information with keys: - “os”: Operating system name - “arch”: CPU architecture - “hostname”: Machine hostname - “username”: Current username - “home”: Home directory path - “cpu_count”: Number of logical CPUs - “total_memory_bytes”: Total RAM in bytes - “total_memory_gb”: Total RAM in gigabytes - “endianness”: Byte order (“little” or “big”) - “executable”: Path to current executable - “is_ci”: True if running in CI environment

sys_is_ci()

def sys_is_ci() -> bool

Returns True if running in a continuous integration (CI) environment.

Detects common CI environment markers including GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, TeamCity, and others. Useful for conditional behavior in CI environments (e.g., stricter checks, different output, timeouts).

Returns

bool: True if running in a detected CI environment, False otherwise

sys_os()

def sys_os() -> string

Returns the current operating system name.

Returns one of the standard OS identifiers: “linux”, “macos”, “windows”, etc. Use this for platform detection and conditional logic.

Returns

str: The operating system identifier (“linux”, “macos”, “windows”, etc.)

sys_total_memory_bytes()

def sys_total_memory_bytes() -> int

Returns the total system memory in bytes.

Gets the total amount of RAM installed on the system. Can be converted to other units (GB, MB) by dividing by 1024.

Returns

int: Total system memory in bytes

sys_total_memory_gb()

def sys_total_memory_gb() -> float

Returns the total system memory in gigabytes.

Convenience function that returns total_memory_bytes() converted to gigabytes.

Returns

float: Total system memory in gigabytes

sys_user_home()

def sys_user_home() -> string

Returns the home directory path of the current user.

Gets the user’s home directory. This is platform-aware: /home/username on Linux, /Users/username on macOS, C:\Users\username on Windows.

Raises: Error: If home directory cannot be determined (rare)

Returns

str: Absolute path to the user’s home directory

sys_username()

def sys_username() -> string

Returns the current username of the process.

Gets the username of the user running the current process. Useful for logging, audit trails, and user-specific configuration.

Returns

str: The current username