Login
Back to bricks list
Introduction 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.

Parameters:
NameTypeDefault valueDescription
streamlit_app_codestr
ADD_RESOURCE

Add a resource to the list

                        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, defaults to True
Parameters:
NameTypeDefault valueDescription
resourceResource Resource to add
create_new_resourcebool True If true, a new resource is created when saving the resource. , optional
ADD_TECHNICAL_INFO

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

Parameters:
NameTypeDefault valueDescription
technical_infoTechnicalInfo 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
Parameters:
NameTypeDefault valueDescription
itemAny
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_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

Parameters:
NameTypeDefault valueDescription
keystr 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

Parameters:
NameTypeDefault valueDescription
resource_model_idstr Id of the resourcemodel
Return type:
bool
INDEX
Parameters:
NameTypeDefault valueDescription
itemAny
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

Parameters:
NameTypeDefault valueDescription
resourcesDict Dict where key is the resource model id and value is the resource [str, resource]
REVERSE
SET_PARAM

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

Parameters:
NameTypeDefault valueDescription
keystr Key of the parameter
valueAny 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.

Parameters:
NameTypeDefault valueDescription
paramsdict Parameters
SET_STREAMLIT_CODE

Set the streamlit code dynamically.

Parameters:
NameTypeDefault valueDescription
streamlit_codestr Eamlit code str
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.

:raises Exception: if the file does not exist

Parameters:
NameTypeDefault valueDescription
streamlit_app_code_pathstr Path to the eamlit code str
SET_STREAMLIT_FOLDER

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

Parameters:
NameTypeDefault valueDescription
streamlit_app_folder_pathstr
SORT
Parameters:
NameTypeDefault valueDescription
keyAny
reversebool False
TO_LIST

Return the resources as a list

Return type:
List
CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
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.

Parameters:
NameTypeDefault valueDescription
icon_technical_namestr Technical name of the icon if provided, the icon_type must also be provided, defaults to none , optional
icon_typeTypingIconType Type of the icon if provided, the icon_technical_name must also be provided, defaults to none , optional
background_colorstr Background color, defaults to none , optional
icon_colorTypingIconColor Icon color, defaults to none , optional
Return type:
TypingStyle
DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
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

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
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.

Parameters:
NameTypeDefault valueDescription
streamlit_app_code_pathstr _description_
Return type:
StreamlitResource