Deprecation Warning: DeckGL (pydeck) maps to require Mapbox token for Production usage

2020-05-21

Community Members -

I wanted to take a moment to thank all of you for trying out Streamlit, and especially your willingness to share your content and promote Streamlit on our behalf! As an open-source project, our success is directly related to not only meeting the needs of our users, but also having a vibrant community willing to tell their successes on our behalf. An unfortunate side-effect of our rapid growth is that the ability to provide an unrestricted Mapbox token is quickly becoming untenable from a cost perspective.

As a bit of background, versions 0.60.0 and earlier of Streamlit have included a Mapbox token for ease of development: users can call streamlit.pydeck_chart() or st.map() with the appropriate arguments and instantly see a nicely rendered geospatial visualization:

At launch, our user base was small enough where providing a Mapbox token didnā€™t exceed the free usage tier, so it made perfect sense to provide a token for a friction-less development experience. However, now that Streamlit has proven its effectiveness for users to easily create data apps, and as users look to move apps into production, we need to make some changes to this policy.

STARTING IN Q4 2020 or later (and at least several more Streamlit releases):

Any Streamlit core widget using Mapbox (currently, streamlit.pydeck_chart() and st.map()) will have a Mapbox token that only works on localhost.

Our goal with this change is to maintain the friction-less Streamlit development experience and to provide the streamlit hello demos for personal usage. All weā€™re asking is that users who are putting applications into production, whether at an actual place of business or for public demonstration, sign up for their own Mapbox token (which is FREE for moderate usage levels).

It is not our intention to catch the Streamlit community off-guard, intentionally break apps currently in production, or break old versions of Streamlit (hence, the long lead time of this notice). We are still working out the technical specifics of this change in this pull request if you would like to follow the progression of this change.

This change is also NOT a backdoor into asking users to pay for Streamlit! The Streamlit Python library is released under the Apache 2.0 open-source license, and will continue to be free for usage under the terms of that license agreement.

If there are any questions, please feel free to leave a comment below and I will be happy to clarify. When our engineering team decides on the actual deprecation date, I will update this post.

Best,

Randy Zwitch
Head of Developer Relations, Streamlit


FAQ / Summary / tl;dr

1. What is changing and when is this happening?

Starting Q4 2020 or later, Streamlit apps running in production will need to use their own Mapbox token, which is free for moderate levels of usage.

2. Is this a sneaky way to get users to pay to use Streamlit?

No! No changes are being made to the Streamlit terms of usage under the Apache 2.0 license. The Python library will continue to be free for use in creating data apps or any other permissible usage under the terms of the license.

3. But, this is still going to cost me money?

Maybe. Depending on the volume of your appā€™s Mapbox calls, you may need to pay Mapbox. This is unlikely for personal usage volumes, but may still happen. Please read the Mapbox terms carefully when you create an account on their site.

4. The code is open-source, couldnā€™t I just patch the key to work outside of localhost?

Possibly, but hopefully not.

5. Are you worried about users patching the key?

No. Weā€™re working with Mapbox to have the token only work on localhost, which should solve a majority of any possible issues. But as with all open-source projects, we rely on the goodwill and good nature of developers to do the right thing :slight_smile:

4 Likes

How feasible would it be to use another tile server like Open street maps rather than map box? Or making it easier for a developer to supply there own tile server URL. This would really help with streamlitā€™s portability on to on prem solutions.

Hi @Liam_Wilkinson, welcome to the Streamlit community!

I donā€™t know that weā€™ve specifically evaluated OSM, but the overall idea of flexibility and customization is behind our component framework thatā€™s currently in beta:

https://discuss.streamlit.io/t/interested-in-creating-and-or-testing-components/2962/2

So while Streamlit the project itself might not directly incorporate other tile servers, hopefully the component allows for doing this if a community member decides to take that on.

Best,
Randy

1 Like

Hi @randyzwitch,

thank you for providing such a powerful tool.
I would like create a simple scatterplot map and want to use pydeck. When I run script/chart in Jupyter notebook, it works perfectly. But when I try to run it in streamlit (on an EC2 Server in AWS), then I only get the scattered dots, but an empty space in the background instead of a map.
I have my own token, both in the linux environment and hard coded into the script. I run on streamlit 0.62. Does this issue base on the depreciation you mentioned above or is it worth to open a new thread?

Best,
Marius

Hi @mariusgarbowski -

We just did a patch release, 0.62.1, which modified the behavior of the Mapbox token. Could you try to update your package, then retry on AWS? Hopefully, that should fix your issue.

Best,
Randy

Hi @randyzwitch

thank you for the quick response. It works now, (almost) perfectly. Unfortunately, st.pydeck_chart does not take my own map_style, but standard styles, only. Does it mean that streamlit does not pass my own token but itā€™s standard token to mapbox?

Best,
Marius

1 Like

Weā€™ll move this to the documentation, but in the meantimeā€¦

For anyone coming across an issue where custom functionality doesnā€™t get picked up when using a Mapbox token, please be sure to copy your Mapbox token into your config.toml file. Streamlit currently does not pick up tokens from inside a Python script, as we expect that users wouldnā€™t want to commit tokens into a version control system (weā€™ll re-evaluate that assumption internally).

To add your Mapbox token, please add the following line to your config.toml file (or create one if necessary):

[mapbox]

# Configure Streamlit to use a custom Mapbox token for elements like st.deck_gl_chart and st.map. To get a token for yourself, create an account at https://mapbox.com. It's free (for moderate usage levels)!
# Default: ""
token = ""

ref: https://docs.streamlit.io/en/stable/cli.html?highlight=config.toml#view-all-config-options