Skip to content

Commit

Permalink
Release 0.46.0 (streamlit#170)
Browse files Browse the repository at this point in the history
* Restore correct vertical spacing for report elements.

* Break Block.tsx into more functions.

* Tiny refactors in Block.tsx

* Add "key" property to element in DocString, to avoid warnings.

* Fix streamlit#1230: OSError not caught when writing cache to disk

* Don't show hashing warning when user imports a module inside a cached function.

* Fix streamlit#6: report should loads element by element (was broken since Sidebar PR)

* Try to fix CircleCI issue: Method 'renderElementWithErrorBoundary' expected no return value

* Add typing to function.

* Remove unecessary dockerfiles

* Fix a bunch of examples

* Fix color of syntax error code in modal dialog.

* Remove old style copyright from conftest.py

* Remove st.warning when hashing a class.

* Add astor to Python requirements

* Update widget API in some e2e tests

* Clean up st.foo_widget() signatures in st.help()

* Lint docs/getting_started.md

* Clean up widget examples in docstrings.

* Add comment to slider examples in docs.

* Tweak Streamlit's description in setup.py

* Sort pipfile modules

* Re-add scripts and Makefile rules to publish packages to conda.

* Fix update_version.py to support new conda location and remove old docker folder.

* Make `streamlit config show` pipeable to a file.

* Update docs/ site

* Remove /docs/api invalidation from Makefile

* Improve docstring for st.slider

* Remove st.Cache (capital C) from __init__ while we figure out what to call it.

* Up version to 0.45.0

* Turn off tests for st.Cache (capital C)

* Try turning off tests again

* Rename multiselectbox to multiselect

* Make bash line in dialog more easily copy/paste-able

* [docs] Add analytics; redirect /secret/docs; fix compilation problem (streamlit#149)

* Restore correct vertical spacing for report elements.

* Break Block.tsx into more functions.

* Tiny refactors in Block.tsx

* Add "key" property to element in DocString, to avoid warnings.

* Fix streamlit#1230: OSError not caught when writing cache to disk

* Don't show hashing warning when user imports a module inside a cached function.

* Fix streamlit#6: report should loads element by element (was broken since Sidebar PR)

* Try to fix CircleCI issue: Method 'renderElementWithErrorBoundary' expected no return value

* Add typing to function.

* Remove unecessary dockerfiles

* Fix a bunch of examples

* Fix color of syntax error code in modal dialog.

* Remove old style copyright from conftest.py

* Remove st.warning when hashing a class.

* Add astor to Python requirements

* Update widget API in some e2e tests

* Clean up st.foo_widget() signatures in st.help()

* Lint docs/getting_started.md

* Clean up widget examples in docstrings.

* Add comment to slider examples in docs.

* Tweak Streamlit's description in setup.py

* Sort pipfile modules

* Re-add scripts and Makefile rules to publish packages to conda.

* Fix update_version.py to support new conda location and remove old docker folder.

* Make `streamlit config show` pipeable to a file.

* Update docs/ site

* Remove /docs/api invalidation from Makefile

* Improve docstring for st.slider

* Remove st.Cache (capital C) from __init__ while we figure out what to call it.

* Up version to 0.45.0

* Turn off tests for st.Cache (capital C)

* Try turning off tests again

* Publish docs to both /docs and /secret/docs, until we deprecate /secret/docs in January.

* Improve docs site: add analytics, redirect from secret/docs/, fix DeltaGenerator docs bug

* Fix publish-docs in Makefile

* Talk about magic in docs.

* Fix update_version.py since black changed quote formats.

* Remove code to share static apps publicly.

* Fix clear-cache dialog alignment

* Move items around in main menu.

* Rename examples/widgets.py to interactive_widgets.py to avoid collision with Seaborn package names.

* Remove examples/saving.py since public saving is not a thing anymore.

* Fix mnist-cnn.py so it works with the latest keras.

* Fix streamlit#152: Implement unsafe_allow_html stopgap in st.write and st.markdown

* Prettified user-visible print statements. Nicer colors, mostly.

* Only import Plotly libraries when needed

* Update screenshots

* Version 0.46.0

* Remove conda from docs

* Added emojis to changelog!

* Fix tests.

* Fix tests
  • Loading branch information
tvst authored Sep 23, 2019
1 parent f39a6a7 commit 648b30d
Show file tree
Hide file tree
Showing 134 changed files with 418 additions and 429 deletions.
39 changes: 0 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -277,45 +277,6 @@ distribute:
cd lib/dist; \
twine upload $$(ls -t *.whl | head -n 1)

.PHONY: prepare-conda-repo
prepare-conda-repo:
mkdir -p /var/tmp/streamlit-conda
aws s3 sync \
s3://repo.streamlit.io/streamlit-forge/ \
/var/tmp/streamlit-conda/streamlit-forge/ \
--profile streamlit

.PHONY: conda-packages
conda-packages:
cd scripts; \
./create_conda_packages.sh

.PHONY: serve-conda-packages
serve-conda-packages:
cd /var/tmp/streamlit-conda; \
python -m SimpleHTTPServer 8000 || python -m http.server 8000

.PHONY: conda-dev-env
conda-dev-env:
conda env create -f scripts/conda/test_conda_env.yml

.PHONY: clean-conda-dev-env
clean-conda-dev-env:
conda env remove -n streamlit-dev

.PHONY: distribute-conda-packages
distribute-conda-packages:
aws s3 sync \
/var/tmp/streamlit-conda/streamlit-forge/ \
s3://repo.streamlit.io/streamlit-forge/ \
--acl public-read \
--profile streamlit

aws cloudfront create-invalidation \
--distribution-id=E3V3HGGB52ZUA0 \
--paths '/*' \
--profile streamlit

.PHONY: notices
# Rebuild the NOTICES file.
notices:
Expand Down
38 changes: 37 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,41 @@ this API reference.
:depth: 1
```

## Magic commands

Magic commands are a feature in Streamlit that allows you to write markdown and
data to your app with very few keypresses. Here's an example:

```python
# Draw a title and some text to the app:
'''
# This is the document title
This is some _markdown_.
'''

df = pandas.DataFrame({'col1': [1,2,3]})
df # <-- Draw the dataframe

x = 10
'x', x # <-- Draw the string 'x' and then the value of x
```

How it works is simple: any time Streamlit sees either a variable or literal
value on its own line, it automatically writes that to your app using
[`st.write`](api.html#streamlit.write) (which you'll learn about later).

Also, magic is smart enough to ignore docstrings. That is, it ignores the
strings at the top of files and functions.

If you prefer to call Streamlit commands more explicitly, you can always turn
magic off in your `~/.streamlit/config.toml` with the following setting:

```toml
[runner]
magicEnabled = false
```

## Display text

Streamlit apps usually start with a call to `st.title` to set the
Expand All @@ -24,7 +59,8 @@ Pure text is entered with `st.text`, and Markdown with
`st.markdown`.

We also offer a "swiss-army knife" command called `st.write`, which accepts
multiple arguments, and multiple data types.
multiple arguments, and multiple data types. And as described above, you can
also use [magic commands](api.html#magic-commands) in place of `st.write`.

```eval_rst
.. autofunction:: streamlit.text
Expand Down
22 changes: 18 additions & 4 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,26 @@ See highlights, bug fixes, and known issues for Streamlit releases:
# PIP
$ pip install --upgrade streamlit
```

.. code-block:: bash
## Version 0.46.0

# Conda
$ conda update streamlit
```
_Release date: September 19, 2019_

**Highlights:**

- ✨ Magic commands! Use `st.write` without typing `st.write`. See
https://streamlit.io/docs/api.html#magic-commands
- 🎛️ New `st.multiselect` widget.
- 🐍 Fixed numerous install issues so now you can use `pip install streamlit`
even in Conda! We've therefore deactivated our Conda repo.
- 🐞 Multiple bug fixes and additional polish in preparation for our launch!

**Breaking change:**

- 🛡️ HTML tags are now blacklisted in `st.write`/`st.markdown` by default. More
information and a temporary work-around at:
https://github.com/streamlit/streamlit/issues/152

## Version 0.45.0

Expand Down
14 changes: 8 additions & 6 deletions docs/core_mechanics.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ different element in the app. For example the
[`st.text`](api.html#streamlit.text)
command writes pure text to the app, and
[`st.line_chart`](api.html#streamlit.line_chart) draws — you guessed it
— a line chart. The swiss army knife of Streamlit commands is
[`st.write`](api.html#streamlit.cache), which we'll get to later.
— a line chart. The swiss army knife of Streamlit commands are our [magic
commands](api.html#magic-commands) and [`st.write`](api.html#streamlit.cache), which
we'll get to later.

## Updating the app

Expand Down Expand Up @@ -45,11 +46,11 @@ All drawing commands in the `streamlit` module _append_ elements to your
Streamlit app.

```python
st.write('''
'''
We analyze the stock market using some tried-and-true _FooBarian_ model
analysis, with parameters _blorg_ and _bleep_ set to `0` and `1`
initially. Then we optimize them by _frobnicating_ the _plumbus_.
''')
'''
# Appends a paragraph to the app.

my_data = np.random.randn(100, 2)
Expand All @@ -60,8 +61,9 @@ st.line_chart(my_data)

## Redrawing/replacing elements in an app

All of Streamlit's drawing commands (with the exception of `st.write`) return
an object that can be used to update/redraw that element:
All of Streamlit's drawing commands (with the exception of `st.write` and
interactive widgets) return an object that can be used to update/redraw that
element:

```python
my_element = st.text('Hey there')
Expand Down
72 changes: 53 additions & 19 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ st.markdown(
```

There's one more method we're going to cover that allows you to add text to a
app. [`st.write()`](api.html##streamlit.write) is the only text method that
accepts multiple arguments and data types. We consider it the "Swiss Army
knife" of Streamlit commands.
app. [`st.write()`](api.html#streamlit.write) is the only text method that
accepts multiple arguments and data types. Along with [magic
commands](api.html#magic-commands), [`st.write()`](api.html#streamlit.write) is
the "Swiss Army knife" of Streamlit commands.

You can pass almost anything to `st.write()`: text, data, Matplotlib figures,
Altair charts, and more. Don't worry, Streamlit will figure it our and render
it the right way. While powerful, there are limitations, so we encourage you to
review the [API reference](api.html#streamlit.write).
You can pass almost anything to [`st.write`](api.html#streamlit.write): text,
data, Matplotlib figures, Altair charts, and more. Don't worry, Streamlit will
figure it our and render it the right way. While powerful, there are
limitations, so we encourage you to review the [API
reference](api.html#streamlit.write).

Let's take a look at how you can use `st.write()` to display text and a Pandas
data frame:
Expand All @@ -183,6 +185,29 @@ st.write(pandas.DataFrame({
}))
```

## Write to your app without any Streamlit command

Streamlit supports "[magic commands](api.html#magic-commands)" that allow you
to write to your app without calling any `st.something()` method. This means
you don't usually have to write [`st.write`](api.html#streamlit.write) at all!
So the code above could be replaced with:

```python
"Here's our first attempt at using data to create a table:"

df = pandas.DataFrame({
'first column': [1, 2, 3, 4],
'second column': [10, 20, 30, 40]
})

df
```

How it works is simple: any time Streamlit sees a variable or a literal value
on its own line, it automatically writes that to your app using
[`st.write`](api.html#streamlit.write). For more information, refer to the
documentation on [magic commands](api.html#magic-commands).

## Visualize data

Text is great, but Streamlit's strength is the ability to quickly manipulate
Expand All @@ -200,16 +225,25 @@ Streamlit methods to create interactive tables, charts, histograms, and more.
### Display data and tables

There are a few ways to display data (tables, arrays, data frames) in Streamlit
apps. In the previous section, you were introduced to `st.write()`, which
can be used to write anything from text to tables. Now let's take a look at
methods designed specifically for visualizing data. You might be asking
yourself, "why wouldn't I always you `st.write()`?" The main reason is that you
can't reuse the slot in the app created by `st.write()`. Put simply, you
can't update any elements created with `st.write()`.

Let's create a data frame. In this sample, you'll use Numpy to generate a
random sample, and the [`st.dataframe()`](api.html#streamlit.dataframe) method
to draw the interactive table.
apps. In the previous section, you were introduced to _magic_ and `st.write()`,
which can be used to write anything from text to tables. Now let's take a look
at methods designed specifically for visualizing data. You might be asking
yourself, "why wouldn't I always use `st.write()`?" Two reasons:

1. Magic and `st.write` inspect the type of the data you passed in, and then
decide how to best draw it in the app. But sometimes you want to draw it
another way. For example, instead of drawing a dataframe as an interactive
table, you may want to draw it as a static table by using `st.table(df)`.
2. The second reason is that other methods return an object that can be used
to modify it by adding data or replacing it with a completely different
element.
3. Finally, if you use a more specific Streamlit method you can pass additional
arguments to customize its behavior.

For example, let's create a data frame and change its formatting with a Pandas
Styler object. In this sample, you'll use Numpy to generate a random sample,
and the [`st.dataframe()`](api.html#streamlit.dataframe) method to draw the
interactive table.

```eval_rst
.. note::
Expand Down Expand Up @@ -381,7 +415,7 @@ import time
Now, let's create a progress bar:

```Python
st.write('Starting a long computation...')
'Starting a long computation...'

# Add a placeholder
latest_iteration = st.empty()
Expand All @@ -393,7 +427,7 @@ for i in range(101):
bar.progress(i + 1)
time.sleep(0.1)

st.write('...and now we\'re done!')
'...and now we\'re done!'
```

## Add interactivity with widgets
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ pip install --upgrade streamlit
$ streamlit version
```

...and then verify that the version number printed is `0.45.0`.
...and then verify that the version number printed is `0.46.0`.

**Try reproducing the issue now.**

Expand Down
Loading

0 comments on commit 648b30d

Please sign in to comment.