Skip to content

proxystore.utils.environment

Utilities related to the current execution environment.

home_dir()

home_dir() -> str

Return the absolute path to the proxystore home directory.

If set, $PROXYSTORE_HOME is preferred. Otherwise, $XDG_DATA_HOME/proxystore is returned where $XDG_DATA_HOME defaults to $HOME/.local/share if unset.

Source code in proxystore/utils/environment.py
def home_dir() -> str:
    """Return the absolute path to the proxystore home directory.

    If set, `$PROXYSTORE_HOME` is preferred. Otherwise,
    `$XDG_DATA_HOME/proxystore` is returned where `$XDG_DATA_HOME` defaults
    to `$HOME/.local/share` if unset.
    """
    path = os.environ.get('PROXYSTORE_HOME')
    if path is None:
        prefix = os.environ.get('XDG_DATA_HOME') or os.path.expanduser(
            '~/.local/share',
        )
        path = os.path.join(prefix, 'proxystore')
    return os.path.abspath(path)

hostname()

hostname() -> str

Return current hostname.

Source code in proxystore/utils/environment.py
def hostname() -> str:
    """Return current hostname."""
    return socket.gethostname()