ruins.core.config#

Module Contents#

Classes#

Config

Streamlit app Config object.

Attributes#

session_state

ruins.core.config.session_state#
class ruins.core.config.Config(path: str = None, **kwargs)#

Bases: collections.abc.Mapping

Streamlit app Config object.

This class holds all configs needed to run the apps. It can be instantiated just like this to load default values. If a path is provided, it will load the configs from the referenced json file. Any config can be updated by passed kwargs.

This design makes the config updateable and easy to to manage. At the same time it can be persisted to the disk and even mirrored to a database if needed in the future.

property debug#
property story_mode#
from_json(path: str) dict#

loads the content of the JSON config file

_update(new_settings: dict) None#

Update this instance with new settings

get_control_policy(control_name: str) str#

Get the control policy for the given control name.

allowed policies are:
  • show: always show the control on the main container

  • hide: hide the control on the main container, but move to the expander

  • ignore: don’t show anything

translator(**translations: Dict[str, str]) Callable[[str], str]#

Return a translator function

get(key: str, default=None)#

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

has_key(key) bool#
__len__() int#
__iter__()#
__getitem__(key: str)#
__setitem__(key: str, value)#