barfi
barfi copied to clipboard
[Feature Request] Add hidden as a valid type for the build_option function in option_builder.py
In option_builder (https://github.com/krish-adi/barfi/blob/main/barfi/option_builder.py), the build_option function sets the option and valid types.
When we associate a function to a block e.g.
my_function_name(self):
do_something
my_block.add_compute(my_function_name)
There is no way to pass custom params to the associated function that are not exposed to the user. It's beneficial to be able to pass params to the block's associated function without exposing them to the user.
If we try to do something like add a new param e.g.
my_function_name(self, my_custom_param):
do_something
my_block.add_compute(my_function_name(my_custom_param=my_custom_param))
It won't work because there's no way to provide for both self and my_custom_param.
There are several use cases for this but one is using the streamlit session_state and modifying it based upon which block is running.
Let's say we want a message (streamlit.info) that shows users which block is currently running. We can pass the session state to each block's function and modify the message to output which block is running. This is helpful for blocks with long running tasks and general error messaging to the user when something went wrong.