gws_core

Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

Reflex app

RESOURCE
Typing name :  RESOURCE.gws_core.ReflexResource Brick :  gws_core
Parent :
App base

Reflex app

Resource representing a Reflex app instance. https://reflex.dev/.

This resource is used to generate the reflex app from the app config.

The app can be configured in different ways:

  • By providing a Appconfig class annotated with @app_decorator.
  • By providing a folder path that contains the app code. The folder must contain a rxconfig.py file.

This app supports the following features:

  • The app can be run in a virtual environment.
  • The app can be run with or without authentication.
  • The app can use resources as input.
  • The app can use parameters.

/!\ Reflex cannot be installed in a normal Conda or Mamba environment. It must be installed using pip in a virtual environment.

To use it in an conda virtual environment do the following:

channels:
- conda-forge
dependencies:
- pip
- pip:
    - reflex

:param AppResource: description :type AppResource: type

Views
VIEW APPDefault view
View the app in a web browser
VIEW RESOURCE
View the complete resource as json
RESOURCES LIST
List the resources
Attributes
flagged: boolname: 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.

add_multiple_resources
resources : List
_description_
message_dispatcher : MessageDispatcher
add_resource

Add a resource to the AppResource.

resource : Any
_description_
create_new_resource : bool - True
_description_
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) this is a long description of the technical information
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_and_check_front_build_folder

Get the folder that contains the front build of the app. This folder is created by the task that generates the app.

Return type : Folder
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_default_style

Get the default style of the resource

Return type : TypingStyle
get_main_app_file_name

Get the name of the main app file. This is the file that will be executed when the app is started.

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

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 app.

Return type : dict
get_resource_by_name

Return the first resource with the given name

name : str
name of the resource
Return type : gws_core.resource.resource.Resource | None
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_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.

init_app_instance

Initialize the app instance with the shell proxy. This method is used to create the app instance that will be used to run the app.

shell_proxy : ShellProxy
resource_model_id : str
app_name : str
requires_authentification : bool - True
Return type : AppInstance
is_empty

Return true if the resource list is empty

Return type : bool
is_virtual_env

Return True if the app is executed in a virtual environment.

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
save_new_children_resources
resource_origin : ResourceOrigin
scenario : Scenario
task_model : TaskModel
port_name : str
Return type : List[ResourceModel]
set_app_config

Set the app config that will be used to generate the app. The AppResource stores the app config typing name to find the app config code. As long as the app config typing name does not change, the app config will be working.

If the app config code is updated, the AppResource will automatically use the updated the app config code.

app_config : Any
app config object annotated with @app_decorator and with get_folder_path method
set_env_shell_proxy

Set the code that will be executed in the app environment. This code is executed before the app is loaded and can be used to load environment variables.

shell_proxy : BaseEnvShell
set_name

Set the name of the resource. You can override this method to force a format for the name of the resource.

name : Optional
name to format
set_param

Set a parameter that will be passed to the 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 app into the 'params' variable.

params : dict
parameters
set_requires_authentication

Set if the app requires the user to be authenticated. By default it requires authentication.

requires_authentication : bool
True if the app requires authentication
set_static_folder

Set the folder that contains the app code.

This is only recommended if you want to force the version of the app in this Resource and avoid automatic updates. Otherwise use the set_app_config method. The folder is copied and stored as a sub resource of the AppResource. The app need to be re-generated to update the code.

app_folder_path : Any
path to the folder that contains the app code
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
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_brick_name @classmethod
Return type : str
get_brick_version @classmethod
Return type : Version
get_human_name @classmethod

Get the human name of the object

Return type : str
get_short_description @classmethod

Get the short description of the object

Return type : str
get_style @classmethod

Get the style of the object

Return type : TypingStyle
get_typing_name @classmethod

Get the typing name of the object Ex: 'RESOURCE.gws_core.Table'

Return type : str
get_typing_name_obj @classmethod
Return type : TypingNameObj
inheritors @classmethod

Get all the classes that inherit this class

Return type : List