pyslk.config.set#
- class pyslk.config.set(**kwargs: str | Path)#
Set pyslk configuration to intract with the slk backend.
This class can be used to set specifics on the the backend version of slk, for example the path the th slk binary or the slk version.
- Parameters:
- **kwargs: str | Path
key-value pairs of the config values to set.
Examples
Set the specific slk version that is loaded on startup:
from pyslk import pyslk pyslk.config.set(slk_version="3.3.76")
It would be also possible to set the path to the slk binary. By default the the set class checks the path to the binary of the slk command. To set a custom path you can use the
slk
key. This time we are using the context manager to temporarely override the default path.from pyslk import pyslk with pyslk.config.set( slk="/sw/spack-levante/slk-3.3.73-nl4md3/bin/slk", slk_helpers="/sw/spack-levante/slk-3.3.73-nl4md3/bin/slk_helpers"): print(pyslk.config.get("__slk_version__")) print(pyslk.config.get("__slk_helpers_version__")) print(pyslk.config.get("__slk_version__")) print(pyslk.config.get("__slk_helpers_version__")) # 3.3.73 1.5.7 3.3.21 1.2.4
- __init__(**kwargs: str | Path)#
Methods
__init__
(**kwargs)get_path
(key)Get the path to the binary of slk
get_version
(command)Get the version of a command
Attributes
config
Default slk/slk_helpers commands, stored in the config cache.