taipy.common.config package
The taipy.common.config package provides features to configure a Taipy application.
Its main class is the Config singleton. It exposes various static methods
and attributes to configure the Taipy application and retrieve the configuration values.
Standard usage
from taipy.common.config import Config
from taipy.common.config import Frequency
from taipy.common.config import Scope
data_node_cfg = Config.configure_data_node("my_data_node", scope=Scope.SCENARIO)
Config.configure_scenario("my_scenario", additional_data_node_configs=[data_node_cfg], frequency=Frequency.DAILY)
Config.configure_core(repository_type="filesystem", storage_folder="my/storage/folder")
Config.configure_authentication(protocol="taipy",roles={"user1": ["role1", "TAIPY_READER"]})
print(Config.data_nodes["my_data_node"].scope) # Output: SCENARIO
print(len(Config.scenarios["my_scenario"].data_nodes)) # Output: 1
In this example, the static methods of the Config singleton are used to configure
a Taipy application. The application has one data node configuration and one scenario
configuration.
We also configure the application to use a filesystem repository and set up authentication.
Frequency and Scope for scenario and data nodes configurations
Besides the Config class which is the main entrypoint, the taipy.common.config package exposes
the Frequency and Scope enums that are frequently used to configure data nodes and
scenarios.
The three objects are exposed in the taipy package directly for convenience.
Classes¶
Config: Singleton class that manages the configuration of a Taipy application.Frequency: Frequency of the recurrence ofCycleandScenarioobjects.GlobalAppConfig: Configuration attributes related to the global application.Scope: Scope of aDataNodeConfigor aDataNode.Section: An abstract class representing a subdivision of the configuration classConfig.UniqueSection: An abstract class representing a subdivision of the configuration classConfig.