gws_core

Introduction
Sub doc 2
Another doc
Folder
How to create a doc ?
Test Folder
Technical documentations
Version

Streamlit App

RESOURCE
Typing name :  RESOURCE.gws_core.StreamlitResource Brick :  gws_core

Streamlit App

Resource that contains a streamlit dashboard. See Streamlite live task to see how to generate it.

Views
DASHBOARDDefault view
Dahsboard generated with streamlit
VIEW RESOURCE
View the complete resource as json
RESOURCES LIST
List the resources
Attributes
name: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDictuid: str
Functions
__init__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.

streamlit_app_code : str
add_resource

Add a resource to the list

resource : Resource
resource to add
create_new_resource : bool - True
If true, a new resource is created when saving the resource. Otherwise it doesn't create a new resource but references it. In this case the resource must be an input of the task that created the ResourceList and the resource must have been saved before
add_technical_info

Add technical information on the resource. Technical info are useful to set additional information on the resource.

technical_info : TechnicalInfo
technical information to add (key, value)
check_resource

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type : Optional
clear
clear_resources
clone

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type : ResourceType
count
item : Any
Return type : int
get_default_name

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type : str
get_model_id

Get the id of the resource model in the database. It is provided by the system for input resources of a task.

Return type : str
get_name_or_default

Get the name of the resource or the default name if the name is None

Return type : str
get_params

Get the parameters that will be passed to the streamlit app.

Return type : dict
get_resource_model_ids

Return the resource model ids of the sub resources

Return type : Set
get_resource_models

Return the resource models of the sub resources list

Return type : List[ResourceModel]
get_resources

Return the sub resources as a list

Return type : List
get_resources_as_set

Return the sub resources as a set

Return type : Set
get_streamlit_app_code

Get the streamlit code.

Return type : str
get_streamlit_folder
Return type : str
get_technical_info

Get the technical information of the resource

key : str
key of the technical information
Return type : TechnicalInfo
has_resource_model

Return true if the resource with the given id is in the resource list

resource_model_id : str
id of the ResourceModel
Return type : bool
index
item : Any
Return type : int
init

This can be overwritten to perform custom initialization of the resource. This method is called after the init (constructor) of the resource. The values of RFields are set when this method is called.

is_empty

Return true if the resource list is empty

Return type : bool
replace_resources_by_model_id

Replace current resources by the resources in the dict

resources : Dict
dict where key is the resource model id and value is the resource
reverse
set_param

Set a parameter that will be passed to the streamlit app into the 'params' variable.

key : str
key of the parameter
value : Any
value of the parameter (must be serializable to json)
set_params

Set the parameters that will be passed to the streamlit app into the 'params' variable.

params : dict
parameters
set_streamlit_code

Set the streamlit code dynamically.

streamlit_code : str
streamlit code
set_streamlit_code_path

Set the streamlit code from a file path. The file will be read and the content will be set as the streamlit code. Don't use this if you have multiple files for the streamlit app. In this case, use the set_streamlit_folder method.

streamlit_app_code_path : str
path to the streamlit code
set_streamlit_folder

Set the folder that contains the streamlit code. The folder must contain a main.py file.

streamlit_app_folder_path : str
sort
key : Any
reverse : bool - False
to_list

Return the resources as a list

Return type : List
classname @classmethod

Returns the name of the class

slugify : bool - False
True to slugify the class name if True
snakefy : bool - False
True to snakefy the class name if True
replace_uppercase : bool - False
Replace upper cases by "-" if True
Return type : str
copy_style @classmethod

Copy the style of the resource with the possibility to override some properties. Useful when settings the style for a task based on the resource style.

icon_technical_name : str
technical name of the icon if provided, the icon_type must also be provided
icon_type : TypingIconType
type of the icon if provided, the icon_technical_name must also be provided
background_color : str
background color
icon_color : TypingIconColor
icon color
Return type : TypingStyle
decorated_method_names @classmethod
decorator_name : Any
full_classname @classmethod

Returns the full name of the class

slugify : bool - False
Slugify the returned class name if True
snakefy : bool - False
Snakefy the returned class name if True
Return type : str
get_human_name @classmethod

Get the human name of the resource

Return type : str
get_short_description @classmethod

Get the short description of the resource

Return type : str
get_typing_name @classmethod

Get the typing name of the resource

Return type : str
inheritors @classmethod

Get all the classes that inherit this class

Return type : List
method_names @classmethod

Returns the list of the methods

Return type : List
module_name @classmethod

Returns the module name of the class

Return type : str
property_method_names @classmethod
property_names @classmethod

Retrieves the property names

instance : type
The types of the properties to retrieve. Set `None` to retrieve all.
exclude : type
Return type : List
from_code_path @staticmethod

Create a StreamlitResource from a file path. The file will be read and the content will be set as the streamlit code. Don't use this if you have multiple files for the streamlit app. In this case, use the set_streamlit_folder method.

streamlit_app_code_path : str
_description_
Return type : StreamlitResource