Hi everyone, hope you’re great!
I’ve tested the features of custom components v2, and now I want to start a real project, I’d like to use custom components from the beginning so I’m using the v2 template to scaffold my app.
I’m facing the error :
streamlit.errors.StreamlitAPIException: Component 'my-streamlit-app.custom_components' must be declared in pyproject.toml with asset_dir to use file-backed js.
after installing the venv and dependencies, when I create the project with the CLI without changing anything, it works, but when I try a different name for project and package nothing works:
I’d like to have a folder structure like this:
Is there any command or configuration I’m missing?
These are the steps I’ve executed on the command:
[1/8] author_name (John Smith):
[2/8] author_email (john@example.com):
[3/8] project_name (Streamlit Component X): my streamlit app
[4/8] package_name (my-streamlit-app):
[5/8] import_name (my_streamlit_app): custom_components
[6/8] description (Streamlit component that allows you to do X):
[7/8] Select open_source_license
1 - MIT
2 - BSD-3-Clause
3 - ISC
4 - Apache-2.0
5 - GPL-3.0-or-later
6 - LicenseRef-Proprietary
Choose from [1/2/3/4/5/6] (1):
[8/8] Select framework
1 - React + Typescript
2 - Pure Typescript
Choose from [1/2] (1):
And after having the folders ready I did:
uv venv
source .venv/bin/activate
cd ./custom_components/frontend/ && npm i && npm run build
cd ../..
uv pip install -e .
python3 -m streamlit run ./example.py
And faced the error.
Any help will be appretiated, thanks!
