Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check streamlit version on run #65

Closed
tvst opened this issue Sep 10, 2019 · 2 comments · Fixed by #106
Closed

Check streamlit version on run #65

tvst opened this issue Sep 10, 2019 · 2 comments · Fixed by #106
Assignees
Labels
type:enhancement Requests for feature enhancements or new features

Comments

@tvst
Copy link
Contributor

tvst commented Sep 10, 2019

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().
@tvst tvst added the type:enhancement Requests for feature enhancements or new features label Sep 10, 2019
@tconkling tconkling self-assigned this Sep 10, 2019
@tconkling
Copy link
Contributor

@tvst should the styling on this text be flipped? That is, should the "new version" notice at the top be green, and the command prompt be bold white? This would fit the pattern of, e.g., the

  You can now view your Streamlit report in your browser. (green)

  Local URL: http://localhost:3000 (bold white)
  Network URL: http://10.0.1.128:3000 (bold white)

notice.

@tconkling
Copy link
Contributor

@tvst should the styling on this text be flipped? That is, should the "new version" notice at the top be green, and the command prompt be bold white? This would fit the pattern of, e.g., the

  You can now view your Streamlit report in your browser. (green)

  Local URL: http://localhost:3000 (bold white)
  Network URL: http://10.0.1.128:3000 (bold white)

notice.

(Yes)

tconkling added a commit that referenced this issue Sep 13, 2019
Occasionally check the installed streamlit version against the latest in PyPI, and show a notice if there's a new version available.

The check runs randomly with a 5% chance, so that we're not spamming the user frequently.

I used `requests` (instead of urllib) for this, which entailed adding it as an explicit dependency in our Pipfile. All the other places in streamlit that used urllib for fetching over HTTP have been replaced with requests. (And there are some additional tests that didn't previously exist.)

Fixes #65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants