Giter VIP home page Giter VIP logo

streamlit / streamlit Goto Github PK

View Code? Open in Web Editor NEW
31.0K 310.0 2.7K 338.65 MB

Streamlit — A faster way to build and share data apps.

Home Page: https://streamlit.io

License: Apache License 2.0

Makefile 0.20% Shell 0.07% JavaScript 2.79% TypeScript 39.74% HTML 0.13% Batchfile 0.01% Python 56.78% SCSS 0.23% CSS 0.06%
python machine-learning data-science deep-learning data-visualization streamlit data-analysis developer-tools

streamlit's Introduction


Streamlit logo

Welcome to Streamlit 👋

A faster way to build and share data apps.

What is Streamlit?

Streamlit lets you transform Python scripts into interactive web apps in minutes, instead of weeks. Build dashboards, generate reports, or create chat apps. Once you’ve created an app, you can use our Community Cloud platform to deploy, manage, and share your app.

Why choose Streamlit?

  • Simple and Pythonic: Write beautiful, easy-to-read code.
  • Fast, interactive prototyping: Let others interact with your data and provide feedback quickly.
  • Live editing: See your app update instantly as you edit your script.
  • Open-source and free: Join a vibrant community and contribute to Streamlit's future.

Installation

Open a terminal and run:

$ pip install streamlit
$ streamlit hello

If this opens our sweet Streamlit Hello app in your browser, you're all set! If not, head over to our docs for specific installs.

The app features a bunch of examples of what you can do with Streamlit. Jump to the quickstart section to understand how that all works.

Streamlit Hello

Quickstart

A little example

Create a new file streamlit_app.py with the following code:

import streamlit as st
x = st.slider("Select a value")
st.write(x, "squared is", x * x)

Now run it to open the app!

$ streamlit run streamlit_app.py

Little example

Give me more!

Streamlit comes in with a ton of additional powerful elements to spice up your data apps and delight your viewers. Some examples:

Input widgets Dataframes Charts Layout Multi-page apps Fun

Our vibrant creators community also extends Streamlit capabilities using  🧩 Streamlit Components.

Get inspired

There's so much you can build with Streamlit:

Check out our gallery! 🎈

Community Cloud

Deploy, manage and share your apps for free using our Community Cloud! Sign-up here.

Resources

  • Explore our docs to learn how Streamlit works.
  • Ask questions and get help in our community forum.
  • Read our blog for tips from developers and creators.
  • Extend Streamlit's capabilities by installing or creating your own Streamlit Components.
  • Help others find and play with your app by using the Streamlit GitHub badge in your repository:
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](URL_TO_YOUR_APP)

Streamlit App

License

Streamlit is completely free and open-source and licensed under the Apache 2.0 license.

streamlit's People

Contributors

aaj-st avatar akrolsmir avatar anoctopus avatar arraydude avatar dependabot[bot] avatar domoritz avatar erikhopf avatar harahu avatar jrhone avatar kajarenc avatar kantuni avatar karriebear avatar kellyamanda avatar kmcgrady avatar lukasmasuch avatar mayagbarnes avatar monchier avatar nthmost avatar randyzwitch avatar sfc-gh-jgarcia avatar sfc-gh-kbregula avatar sfc-gh-tszerszen avatar sfc-gh-tteixeira avatar sfc-gh-wihuang avatar snehankekre avatar tconkling avatar treuille avatar tvst avatar vdonato avatar willhuang1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

streamlit's Issues

Persistent bug with caching

Summary

This bug happens every time I run this uber.py script. I think it has to do with caching.

Steps to reproduce

Run this uber.py file:

import streamlit as st
import pandas as pd
import numpy as np

DATE_TIME = 'date/time'
DATA_URL = 'https://s3-us-west-2.amazonaws.com/streamlit-demo-data/uber-raw-data-sep14.csv.gz'

lowercase = lambda x: str(x).lower()

@st.cache
def load_data(nrows):
    data = pd.read_csv(DATA_URL, nrows=nrows)
    data.rename(lowercase, axis='columns', inplace=True)
    data[DATE_TIME] = pd.to_datetime(data[DATE_TIME])
    data['hour'] = (data[DATE_TIME].dt.hour + 17) % 24
    return data

data = load_data(100000)
hour = st.slider('hour', 0, 23, 11)
data = data[data[DATE_TIME].dt.hour == hour]

st.write('### Geo Data at %sh' % hour)
midpoint = (np.average(data['lat']), np.average(data['lon']))
st.deck_gl_chart(
    viewport={
        'latitude': midpoint[0],
        'longitude': midpoint[1],
        'zoom': 11,
        'pitch': 50,
    },
    layers=[{
        'type': 'HexagonLayer',
        'data': data,
        'radius': 100,
        'elevationScale': 4,
        'elevationRange': [0, 1000],
        'pickable': True,
        'extruded': True,
    }])

st.write('### Data by Minute at %sh' % hour)
st.bar_chart(np.histogram(data[DATE_TIME].dt.minute, bins=60)[0])

if st.checkbox("Show Raw Data"):
    st.write('### Raw Data at %sh' % hour)
    st.write(data)

Actual behavior:

In v0.45 you will get this:
image

Note

If you hit R to rerun, you will see the right answer.

Expected behavior:

It should run properly the first time.

Is this a regression?

yes

Debug info

$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version
Streamlit, version 0.45.0
Python 3.6.3
pyenv 1.2.3
ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G95
Google Chrome 76.0.3809.132 

Show desktop notification on rerun if tab is inactive.

Problem

  1. User calls streamlit run foo.py
  2. A browser tab shows up with the foo.py app in it
  3. User ctrl-c's out of the server, but leaves the tab open.
  4. User changes tab, works on something else for hours.
  5. User wants to go back to working on foo.py. So she calls streamlit run foo.py

...and then nothing happens. No new browser tab opens, because the tab from (1) is already connected to the new Streamlit server. And the existing tab doesn't come to the top. So the user has no idea where the app loaded.

Solution

Show a notification at step (4), saying:

App yourscript.py is ready.
Click here to see it.

On click, the browser with the Streamlit tab comes to the front and the tab becomes active.

Config

This behavior should be configurable with:

[browser]
showNotificationIfTabInactive = false

On first use, ask nicely for email/metrics

When the user first runs a streamlit foo command on the CLI, we currently show a message asking for the user's email:

  Enter your email for access to our beta

and then show a welcome message:

  Welcome to Streamlit!

  Get started by typing:
  $ streamlit hello

This was fine for our beta, but for a public launch we should:

  1. Ask more nicely for the email, explaining why we need it :)
  2. Allow people to not enter an email if they don't want to
  3. Tell people we log high-level analytics, and let them know how to turn them off. (And as a follow up, we should make it easier to turn this on/off in the future)

Proposal

Replace the first message with:

  👋 Welcome to Streamlit! [in green]

  If you are one of our development partners or are interested in
  getting personal technical support, please enter your email address
  below. Otherwise, you may leave the field blank.

  Email:

and the second with:


  Telemetry: as an open source project, we use collect summary
  statistics and metadata to understand how people are using Streamlit.

  If you'd like to opt out, add the following to ~/.streamlit/config.toml,
  creating that file if necessary:

  [browser]
  gatherUsageStats = false

(leave the first and last lines in this block blank, so it doesn't touch any text we print above or below it.)

Check streamlit version on run

When the user types streamlit run foo.py, check whether a new version of Streamlit is available in PyPI and, if so, print the following message to the terminal:

  A new version of Streamlit is available. [in bold white]
  See what's new at https://streamlit.trydiscourse.com/c/announcements

  Enter the following command to upgrade:
  $ pip install streamlit --upgrade [in green]

Notes:

  • Use the click package to print in color.
  • Add a blank line at the end of the print block, so anything we print after that will be spaced out properly.

Implementation details

  1. You can use this to check for updates: https://pypi.org/pypi/streamlit/json . More info.
  2. We don't want to ping PyPI every time, so a simple solution would be to only look for updates with a 5% probability.
    Alternately, we could check for updates just once a day by using st.cache with persist to cache the update-checking function to disk, and add a max_age parameter to st.cache that lets you set an age at which the cache becomes invalid.
  3. If the user is offline, don't show any errors.
  4. A logicat place to put the update check is in cli.py inside _main_run().

Don't rerun code when changing widgets until press button

Problem

I want to have two date inputs and only have the code rerun after I have finished changing both. A date range slider is the best solution, but I can imagine other situations where I'd want to change multiple inputs before re-running -- like in Project Orient.

Solution

Would be nice to have a way to set it up with st.button so that only on button push does it rerun the code.

Cypress dashboard isn't recording test runs

Broke after creating the new Streamlit repo. Test runs aren't being recorded even though I have the record key environment variable set both in my personal CircleCI and in the Streamlit org CircleCI.

Streamlit scripts take a long time to transfer data

Try this without Streamlit:

for i in range(1000):
    print(i)
print('done')

Result: script prints 'done' within a few dozens of milliseconds


Now try this with Streamlit:

import streamlit as st

for i in range(1000):
    st.write(i)
st.write('done')

Result: script takes several dozens of seconds to print 'done' on the report.


Finally, try this with Streamlit:

import streamlit as st
import time

start_time = time.time()

for i in range(1000):
    st.write(i)

end_time = time.time()
st.write('Total time is', end_time - start_time)

Result: script takes several dozens of seconds to print 'done' on the report, but it prints the total time in the terminal in only a few hundred milliseconds. So the problem is between the Server and the browser.

Streamlit should fail gracefully if `server.port` is already in use.

Problem

It is annoying when I already have Streamlit running in one terminal which blocks the port and prevents Streamlit from running in another port.

Steps to repro

  1. In one terminal, type streamlit run foo.py
  2. In another terminal, type streamlit run bar.py

What happens: the second Streamlit call fails to run because the port is already taken
Desired: we somehow switch ports

Desired solution

When the port is already taken, print this to the terminal:

ERROR: Port %(port)s is already in use.
Please enter another port, or press Enter to exit:

Then, on Enter:

  • If the user leaves this blank, exit
  • If the user types an invalid string or invalid port, print:
    "%(input)s" is not a valid port.
    Please enter another port, or press Enter to exit:
    
  • If the user types a valid port but it's already taken, print the original message from the top of this section.
  • If the user types a valid port, continue.

Possible additions

In our old repo we have a larger discussions around this. We may want to implement some of those solutions later. But for now, let's just do the MVP above.

SelectBox 'title' font seems different than any other text font

Summary

The text in the title of a selectbox seems smaller than other text.

Steps to reproduce

Create a selectbox and render it.

                      ('LinearRegression', 'DecisionTreeRegressor', 'RandomForestRegressor', 'LinearSVR'))

Expected behavior:

The size of the text in Which model do you want to use? is similar to the text in the options.

Actual behavior:

The size of the text for Which model do you want to use? is smaller

Is this a regression?

That is, did this use to work the way you expected in the past?
yes / no

Debug info

  • Streamlit version: Streamlit v0.45.0
  • Python version: 3.7.4
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version: MacOs 10.14.6
  • Browser version: Chrome 76.0.3809.100

Screen Shot 2019-09-03 at 3 19 39 PM

Additional information

If needed, add any other context about the problem here.

On a Mac, check if xcode installed before requiring watchdog

Streamlit watches files in the current folder for changes by using one of two methods:

  1. The watchdog Python module, which uses OS-level event-based APIs
  2. A custom module that polls the files we care about every so often.

If the watchdog module is available on the user's system, we currently use Method 1. If not, we use Method 2.

The problem is that the watchdog module it compiled locally by Pip when the user pip-installs it -- and on a Mac this compilation step requires the free XCode CLI tools with:

xcode-select --install

So what we'd like to do is:

  1. Modify setup.py so we check whether xcode tools are available before making watchdog a dependency (only if the current system is a Mac, of course).
  2. In LocalSourcesWatcher.py, when we fall back to the polling solution, print a message telling the user to install the watchdog module (see below).
  3. Add config option to turn that message off: global.disableWatchdogWarning

Message:

  For better performance, install the Watchdog module:

  $ xcode-select --install [only show this message if on a Mac]
  $ pip install watchdog

(leave a blank line at the end, so the message does not merge with whatever we print after it.)

st.slider output value does not reset

How to repro

  1. Run this script with streamlit
import streamlit as st

end = int(st.sidebar.text_input('Input:', '10'))
slider_output =  st.sidebar.slider('slider', 0, end, 0)
st.write(selected_frame_index)
  1. This is how it shows in the browser

Screen Shot 2019-09-16 at 11 29 15 AM

  1. Change the input to 10 and move the slider all the way to the right. The number 10 should appear in the main column

Screen Shot 2019-09-16 at 11 29 22 AM

  1. Change the input value back to 1

Screen Shot 2019-09-16 at 11 29 29 AM

What happens

The value in the main column is 10

What should happen:

The value in the main column should not be 10, but it should be within the bounds of the slider

Lists inside of DataFrames are unhashable and break st.cache

Summary

A DataFrame which contains a list is unhashable and therefore breaks st.cache.

Steps to reproduce

Run this code

import streamlit as st
import pandas as pd

@st.cache
def return_a_list(n):
    return pd.DataFrame({'n': [n], 'result': [list(range(n))]})


st.text(return_a_list(10))

Behavior

Actual behavior

We get an error with the following stack trace

TypeError: unhashable type: 'list'
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/ScriptRunner.py", line 317, in _run_script exec(code, module.__dict__)
File "/Users/adrien/Desktop/streamlit/streamlit-staging/test_list_bug.py", line 9, in <module> st.text(return_a_list(10))
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/caching.py", line 412, in wrapped_func key, return_value, persist, ignore_hash, args_mutated)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/caching.py", line 307, in _write_to_cache _write_to_mem_cache(key, value, ignore_hash, args_mutated)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/caching.py", line 237, in _write_to_mem_cache hash=None if ignore_hash else get_hash(value),
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/hashing.py", line 89, in get_hash hasher.update(f, context)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/hashing.py", line 159, in update self._update(self.hasher, obj, context)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/hashing.py", line 190, in _update b = self.to_bytes(obj, context)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/hashing.py", line 179, in to_bytes b = self._to_bytes(obj, context)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/streamlit/hashing.py", line 230, in _to_bytes return pd.util.hash_pandas_object(obj).sum()
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/util/hashing.py", line 115, in hash_pandas_object h = _combine_hash_arrays(hashes, num_items)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/util/hashing.py", line 41, in _combine_hash_arrays for i, a in enumerate(arrays):
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/util/hashing.py", line 104, in <genexpr> hashes = (hash_array(series.values) for _, series in obj.iteritems())
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/util/hashing.py", line 286, in hash_array codes, categories = factorize(vals, sort=False)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/util/_decorators.py", line 178, in wrapper return func(*args, **kwargs)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/algorithms.py", line 630, in factorize na_value=na_value)
File "/Users/adrien/.pyenv/versions/3.6.3/envs/streamlit-staging/lib/python3.6/site-packages/pandas/core/algorithms.py", line 476, in _factorize_array na_value=na_value)
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_labels

Expected behavior

This should work, just as if return_a_list weren't decorated with @st.cache.

Is this a regression?

Not sure.

Debug info

$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version
Streamlit, version 0.45.0
Python 3.6.3
pyenv 1.2.3
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G95
Google Chrome 76.0.3809.132 

KeyError: 0 when passing dataframe to st.selectbox

Summary

Need a better warning for when passing a full dataframe to st.selectbox. It says Warning:0. I had assumed that since it was only one column it would be fine, so we need to note that they need to pass through the column.

Steps to reproduce

  1. Create a dataframe
  2. Pass the dataframe to st.selectbox
    var = st.selectbox('Select something', df)

Investigate using List inside of AutoSizer

We're using ReactVirtualized which is built for handling long lists but we're only using the AutoSizer component which handles resizing width or height.

Perhaps using a List component inside the AutoSizer is necessary to trigger long list handling.

Change items available in ☰ menu

  • Remove "Share report" menu item. (But do not remove the sharing logic yet. We'll likely bring it back soon, with different defaults)
  • Add "Community", "Report bug", and "Streamlit for teams"
  • Rearrange items, as shown below

The new menu should look like

Rerun
Edit command
Clear cache
---
Documentation  [links to streamlit.io/docs]
Community  [links to discuss.streamlit.io]
Streamlit for teams  [links to streamlit.io/teams]
---
Report a bug  [links to https://github.com/streamlit/streamlit/issues/new/choose]
---
Settings
About

Parse ./.streamlit/config.toml in the current directory.

Problem

I'd like to run several Streamlit apps simultaneously on the same computer, each with its own port.

Solution

MVP

Parse ./.streamlit/config.toml in the current directory. This should be parsed after ~/.streamlit/config.toml in the home directory, and overrride any settings there.

Example

If ~/.streamlit/config.toml contains:

[runner]
magicEnabled = true

[server]
port = 6789

and ./.streamlit/config.toml contains:

[server]
port = 9999

then the final config would be equivalent to:

[runner]
magicEnabled = true

[server]
port = 9999

Possible additions

Ultimately, we should also allow the user to set config options on the command line.

Widgets with identical "ids" should raise exception

Summary

If you name, for example, two buttons 'abc', you will get some weird behavior (see below).

To avoid this, we should ensure that no two widgets have the same name by raising an exception should the user violate this rule.

Steps to reproduce

Run the following code:

import streamlit as st

if st.button('abc'):
    st.success('First button fired.')
if st.button('abc'):
    st.success('Second button fired.')

Behavior

Actual behavior

The button appears twice (no exceptions thrown):

image

and when you click the button, it fires twice:

image

Expected behavior

The second button named 'abc' should raise an exception.

Is this a regression?

Not sure.

Debug info

$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version

Streamlit, version 0.45.0
Python 3.6.5
pyenv 1.2.3
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G84
Google Chrome 76.0.3809.132 

Update the hamburger menu to increase the discoverability of community features

Problem

The hamburger menu in the upper right could be improved to:

  1. increase the memorability of menu items
  2. increase the discoverability of community features
  3. make sure that new bugs and features are marked with Streamlit engineering
  4. remove (for now) Edit command which is a security risk if the "app" is deployed in an organization
  5. Decrease the number of horiztonal rules.

Solution

Happily, the solution is mostly a reordering of the present menu! I propose the following:

New Menu

Menu Item Shortcut Action Note
Rerun r Rerun the script
Clear cache c Clear the cache
Settings Go to the settings menu
--- --- [Horizontal rule] ---
Documentation streamlit.io/docs
Ask a question discuss.streamlit.io/c/Questions
Submit a bug github.com/streamlit/streamlit/issues/new?assignees=&labels=bug&template=bug_report.md&projects=streamlit/1&title= This will automatically populate the Projects field correctly.
Request a feature github.com/streamlit/streamlit/issues/new?assignees=&labels=enhancement&template=feature_request.md&projects=streamlit/1&title= This will automatically populate the Projects field correctly.
--- --- [Horizontal rule] ---
Community discuss.streamlit.io
Streamlit for teams streamlit.io/teams
About Display the about menu

Note: This removes the Edit command menu item which is a security risk.

Emojis

We should not do this, but for the record, here are some fun emojis we could consdier at some point if the design accomodated it.

Menu Item
🏃🏽‍Rerun
😳Clear cache
⚙️Settings
---
❓Documentation
🙋🏽Ask a question
🐞Submit a bug
🎁Request a feature
---
🍻Community
👩🏽‍💻Streamlit for teams
📜About

Force garbage collection after running a report?

Should we run gc.collect() after ScriptRunner completes (possibly only if no other ScriptRunners are active)?

(This may help with e.g. the tensorflow memory issues Armando was seeing in the Shaobo demo.)

Blink tab title on rerun if tab is inactive.

In Chrome, you can blink the tab title by setting window.title to anything while the tab is inactive.


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

Allow st.selectbox to take a one column dataframe

Low priority issue

Problem

st.selectbox throws an error when you pass it a dataframe even if that df only has one column.

Solution

It should detect if you are passing a dataframe with only one column and accept that.

"Always Run" takes effect only after the Streamlit Window/tab is selected

Summary

When editing code and saving in my IDE with Always Run enabled, the rerun is not immediately kicked off, but it seems I have to click on the Streamlit UI in the browser.

Steps to reproduce

  1. Enable 'Always RUn'
  2. Edit a script in an IDE (I was using PyCharm for this)
  3. Keep the 'focus' on the IDE, but look at the Streamlit UI, possibly on another monitor or on some other part of the screen

Expected behavior:

I expect to see the Streamlit UI re-generate the results every time I save.

Actual behavior:

Nothing happens on the UI. If click on the UI, the computation starts and results are regenerated.

Is this a regression?

That is, did this use to work the way you expected in the past?
N/A

Debug info

  • Streamlit version: Streamlit v0.45.0
  • Python version: 3.7.4
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version: MacOs 10.14.6
  • Browser version: Chrome 76.0.3809.100

Pandas CategoricalIndex not supported

Summary

Pandas supports a Categorical Index datatype. When using st.write(dataframe), if the dataframe contains some categorical data an error is generated.

Steps to reproduce

Create a dataframe with a Categorical Index. For example: uses pd.cut to segment existing numerical data (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.cut.html)
This is a snippet that takes a median_income column and segments it (from https://github.com/ageron/handson-ml/blob/master/02_end_to_end_machine_learning_project.ipynb row 22)

Expected behavior:

No error. The dataframe is shown in the UI.

Actual behavior:

st.write(df['income_cat'])
NotImplementedError: Can't handle <class 'pandas.core.indexes.category.CategoricalIndex'> yet.
st.write(df['income_cat'].value_counts())```
## Is this a regression?
Not that I know

# Debug info
- Streamlit version: Streamlit v0.45.0
- Python version: 3.7.4
- Using Conda? PipEnv? PyEnv? Pex?
- OS version: MacOs 10.14.6
- Browser version: Chrome  76.0.3809.100

# Additional information
If needed, add any other context about the problem here.

Plotly implementation deprecated with Plotly 4

With version 4, plotly has moved all online features to a new chart-studio package.

Steps to reproduce

What are the steps we should take to reproduce the bug:

  1. Import plotly.express as px

Expected behavior:

Plotly should be imported for use with st.plotly_chart()

Actual behavior:

Plotly is unable to be imported.

Screenshot from 2019-09-16 10-26-12

Is this a regression?

Functions as expected with plotly 3.10.

Debug info

  • Streamlit version: 0.45.0
  • Python version: 3.7.4
  • Using Conda
  • OS version: Ubuntu 19.04
  • Browser version: Chrome 77.0.3865.75

Additional information

Not the end of the world as 3.10 is still working; was curious if there is a way to include the necessary version of plotly as a dependency somewhere.

Chart width changed, too skinny

Unable to create Pandas Series in cached functions

Summary

Unable to generate Pandas Series in cached functions.

Steps to reproduce

Run this code:

import streamlit as st 
import pandas as pd

@st.cache
def test_function():
    series = pd.Series()
    return series

test_function()

Expected behavior:

Expect to be able to create Pandas Series inside of cached functions.

Actual behavior:

Following error is thrown:

TypeError: stat: path should be string, bytes, os.PathLike or integer, not property
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/ScriptRunner.py", line 317, in _run_script exec(code, module.__dict__)
File "/home/jforth/Documents/streamlit_test.py", line 9, in <module> test_function()
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/caching.py", line 393, in wrapped_func code_hasher.update(func)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 159, in update self._update(self.hasher, obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 190, in _update b = self.to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 179, in to_bytes b = self._to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 259, in _to_bytes h.update(self._code_to_bytes(obj.__code__, context))
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 316, in _code_to_bytes self._update(h, ref, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 190, in _update b = self.to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 179, in to_bytes b = self._to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 236, in _to_bytes isinstance(obj, io.IOBase) or os.path.exists(obj.name)):
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/genericpath.py", line 19, in exists os.stat(path)

Is this a regression?

Not sure.

Debug info

  • Streamlit version: 0.45.0
  • Python version: 3.7.4
  • Using Conda
  • OS version: Ubuntu 19.04
  • Browser version: Chrome 77.0.3865.75

st.sidebar is showing under other widgets

Summary

When I have two date widgets in the sidebar it is positioning one under the other. See photo attached.

Steps to reproduce

What are the steps we should take to reproduce the bug:

  1. Place two st.date_input into the sidebar

st.sidebar.date_input('start date', datetime.date(2011,01,01))
st.sidebar.date_input('end date', datetime.date(2011,12,31))

Expected behavior:

When widget is open it should pop over anything else in the sidebar until it is closed.

Actual behavior:

Shows underneath the other widget.

Is this a regression?

Unclear

Debug info

  • Streamlit version: 0.45.0

Screen Shot 2019-09-03 at 11 29 15 AM

Frontend: do something reasonable with handleMessage errors

WebsocketConnection.handleMessage can throw errors for a variety of reasons. We're currently swallowing those errors, which leaves a running report in a broken state.

(We may want to just move to the "disconnected forever" state and tell the user that everything blew up.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.