Conversation
tvst
left a comment
There was a problem hiding this comment.
Approved, once comments are addressed.
So excited for this to land 💯
lib/streamlit/cli.py
Outdated
| def _compose_option_parameter(config_option): | ||
| """ | ||
| Composes given config option options as options for click lib. | ||
| """ |
There was a problem hiding this comment.
Fix docstring to match the Numpy docstring style guide.
| """ | ||
| Decorator that adds config param keys to click dynamically. | ||
| """ | ||
| for _, value in reversed(_config._config_options.items()): |
There was a problem hiding this comment.
Why do you need reversed here?
There was a problem hiding this comment.
for some reason the default order gives me the last config item first. I don't know why I just saw it was this way and reversed it.
There was a problem hiding this comment.
Oh actually it makes sense now. click probably reverses them internally so the help string appears in the same order as you declare the decorators. The topmost decorator should show up first on the help.
But the topmost decorator is actually the last decorator that is applied. So on our case, we should reverse again to make sure the thing we want to have at the top is applied last.
lib/streamlit/cli.py
Outdated
| _main_run(filename) | ||
|
|
||
|
|
||
| def _compose_option_parameter(config_option): |
There was a problem hiding this comment.
I think a name like this would be clearer: _convert_config_option_to_click_option
lib/streamlit/cli.py
Outdated
| from validators import url | ||
|
|
||
| # read through all option configs that are set via cmd option param | ||
| # and call set_option to override default/file configs |
lib/streamlit/cli.py
Outdated
| """Run a Python script, piping stderr to Streamlit. | ||
| The script can be local or it can be an url. In the | ||
| latter case, streamlit will download the script to a | ||
| temporary file and runs this file. |
There was a problem hiding this comment.
This is not your doing, but can you make this docstring extend all the way to the 80-character line?
lib/streamlit/cli.py
Outdated
| from validators import url | ||
|
|
||
| # read through all option configs that are set via cmd option param | ||
| # and call set_option to override default/file configs |
There was a problem hiding this comment.
I don't really understand this comment 😕
Can you rephrase? Something like: "The "streamlit run" command supports passing Streamlit's config options as flags. So here we read through all unhandled command-line parameters, massage them, and pass them to _set_config()
lib/streamlit/cli.py
Outdated
|
|
||
| # read through all option configs that are set via cmd option param | ||
| # and call set_option to override default/file configs | ||
| for config_option in kwargs: |
There was a problem hiding this comment.
Can you move this whole for-loop into its own helper function? Something like _apply_config_options_from_cli()
|
|
||
|
|
||
| @main.command("run") | ||
| @configurator_options |
There was a problem hiding this comment.
We should add this to streamlit hello too.
| if old_step is None or old_stop is None: | ||
| raise AttributeError("'RangeIndex' object has no attribute " | ||
| "'step'") | ||
| raise AttributeError("'RangeIndex' object has no attribute " "'step'") |
There was a problem hiding this comment.
The linter messed up here. If it fits within 80 characters, can you join these strings?
There was a problem hiding this comment.
doesn't fit :/
raise AttributeError("'RangeIndex' object has no attribute "
"'step'")
* develop: Support cli parameters (streamlit#186) Update README.md Update README.md (streamlit#282) Bug fix: make Streamlit watch files in subfolders again (streamlit#265) fix st.code("") (streamlit#272) different jslint commands for circleci and not (streamlit#273) Batch updates to report elements in the App state (streamlit#194) Minor typo in pull_request_template.md (streamlit#262) Fix wrong quote used in the provided sample code (streamlit#267) Fix websocket port handling (streamlit#263) Closing sidebar when clicking outside (streamlit#223) Version 0.47.2 (streamlit#212) [docs] Changed value in Show progress section of docs/getting_started.md to fix error (Issue streamlit#234) (streamlit#235) Update README.md Remove checkbox from CLA in PR Template Update README.md Update README.md mapping_demo: catch urllib errors (streamlit#224)
Support cli parameters (#186)
* develop:
Read config from ${CWD}/.streamlit/config.toml (streamlit#227)
Fix unsafe_allow_html (streamlit#259)
Support cli parameters (streamlit#186)
Update README.md
Update README.md (streamlit#282)
Bug fix: make Streamlit watch files in subfolders again (streamlit#265)
fix st.code("") (streamlit#272)
different jslint commands for circleci and not (streamlit#273)
Batch updates to report elements in the App state (streamlit#194)
Minor typo in pull_request_template.md (streamlit#262)
Fix wrong quote used in the provided sample code (streamlit#267)
Fix websocket port handling (streamlit#263)
Closing sidebar when clicking outside (streamlit#223)
Version 0.47.2 (streamlit#212)
[docs] Changed value in Show progress section of docs/getting_started.md to fix error (Issue streamlit#234) (streamlit#235)
Update README.md
issue: https://github.com/streamlit/streamlit-old-private/issues/670
Brief
Fetches all config options available and exposes them as click cmd option params.
Description
You can do things such as

streamlit run --server.port 4031 examples/reference.pynowTo see all available options call
streamlit run --help.👆I don't consider it looks great, I'd prefer it to have a break line after every option, but wasn't able to find a way to format the description for an option in click.
Things that keep this away from being perfect:
--server.port "asd")streamlit run --helpWeird behavior
config._set_optiononly works when the option is not existing in the config file! 🤔