Just deployed my newest drawable-canvas. The app is loaded correctly but the drawable canvas custom component doesn’t, and the logs don’t show anything specific…
Maybe it only happens to me (and I got it working locally and in a clean Docker Python 3.7 container with and without pinning versions). Can anyone else check on it ?
Hey @andfanilo, looks like the src on your component’s iframe is pointing to localhost:3001 – so it’s probably trying to load the iframe from your local webpack devserver, and just needs to bundled into a release build?
Yeah I thought so too, maybe devserver was still running when I tested, so I republished a new version to Pypi and tested it in a clean environment, I get the correct redirection locally.
So then I thought “what if Streamlit Share, instead of using the installed streamlit_drawable_canvas used the folder streamlit_drawable_canvas because they’re not in order in PYTHON_PATH ?”.
I went to edit the _release=True flag in streamlit_drawable_canvas/__init__.py then I got :
Can you paste the code you’re using to create the custom component? Your PYTHON_PATH shouldn’t matter - the code should just be reading from your build directory via a project-relative path.
(Also, if you have a public Github repo for your S4A demo app, you can point me there and I’ll take a look!)
I am not pushing the build directory on Github. I actually don’t want from streamlit_drawable_canvas import st_canvas to go into the __init__.py file but use the published package from requirements.txt, to ensure I published properly .
Ah - I think that’s the issue. Your app imports streamlit_drawable_canvas, but since that package is included in the app’s path, that local copy of the component is what’s being used.
That is: when app.py does from streamlit_drawable_canvas import st_canvas, it’s importing the local streamlit_drawable_canvas directory and not the PyPI package.
In general, if you want to use the published package, I’d recommend moving this S4A app into its own repo. (This is especially true because you essentially have two separate bits of “packaging” data for two separate projects at the root level of the repo - setup.py and MANIFEST.in for the PyPI package, and requirements.txt for the S4A app.)
Gotcha. I didn’t want to split the repo into code + example at first but you’re right, the mixing of those 2 packaging bits will trip me off in the future.
I just didn’t want to build a repo for a single 30 line demo I’ll look into making a big repo with multiple demos…or I’ll just get used to having multiple 30 lines repos
If S4A lets you specify the project root (that is, if it doesn’t assume that the repo is the project root – I’m not au fait on whether this is currently possible), then you could move requirements.txt into examples alongside app.py, and have examples be the root of your S4A project. (The app.py wouldn’t “see” the local streamlit_drawable_canvas folder in its path.)
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.