From fadd5e54d02d3a8c9d50b8cf3a64a9757859f922 Mon Sep 17 00:00:00 2001 From: Bob Nisco Date: Fri, 31 Oct 2025 12:54:45 -0700 Subject: [PATCH 1/2] [fix] Fixup metadata --- cookiecutter/v2/{{ cookiecutter.package_name }}/README.md | 4 ++-- .../v2/{{ cookiecutter.package_name }}/pyproject.toml | 7 +------ .../{{ cookiecutter.import_name }}/pyproject.toml | 7 +++++++ templates/v2/template-reactless/README.md | 4 ++-- .../v2/template-reactless/my_component/pyproject.toml | 7 +++++++ templates/v2/template-reactless/pyproject.toml | 7 +------ templates/v2/template/README.md | 4 ++-- templates/v2/template/my_component/pyproject.toml | 7 +++++++ templates/v2/template/pyproject.toml | 7 +------ 9 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml create mode 100644 templates/v2/template-reactless/my_component/pyproject.toml create mode 100644 templates/v2/template/my_component/pyproject.toml diff --git a/cookiecutter/v2/{{ cookiecutter.package_name }}/README.md b/cookiecutter/v2/{{ cookiecutter.package_name }}/README.md index 76d37c3d..f75f3555 100644 --- a/cookiecutter/v2/{{ cookiecutter.package_name }}/README.md +++ b/cookiecutter/v2/{{ cookiecutter.package_name }}/README.md @@ -39,9 +39,9 @@ To package this component for distribution: npm run build ``` -2. Build the Python wheel using UV (from the project root with `pyproject.toml`): +2. Build the Python wheel using UV (from the project root): ```sh - uv run --with build python -m build --wheel + uv build ``` This will create a `dist/` directory containing your wheel. The wheel includes the compiled frontend from `{{ cookiecutter.import_name }}/frontend/build`. diff --git a/cookiecutter/v2/{{ cookiecutter.package_name }}/pyproject.toml b/cookiecutter/v2/{{ cookiecutter.package_name }}/pyproject.toml index c81fc679..5c6dbc7d 100644 --- a/cookiecutter/v2/{{ cookiecutter.package_name }}/pyproject.toml +++ b/cookiecutter/v2/{{ cookiecutter.package_name }}/pyproject.toml @@ -9,8 +9,7 @@ description = "{{ cookiecutter.description }}" readme = "README.md" requires-python = ">=3.10" authors = [{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" }] -# TODO: Restore this -# dependencies = ["streamlit >= 1.51"] +dependencies = ["streamlit >= 1.51"] [project.optional-dependencies] devel = [ @@ -33,7 +32,3 @@ include-package-data = true [tool.setuptools.package-data] {{ cookiecutter.import_name }} = ["frontend/build/**/*", "pyproject.toml"] - -[[tool.streamlit.component.components]] -name = "{{ cookiecutter.import_name }}" -asset_dir = "{{ cookiecutter.import_name }}/frontend/build" diff --git a/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml b/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml new file mode 100644 index 00000000..fafe5a56 --- /dev/null +++ b/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml @@ -0,0 +1,7 @@ +[project] +name = "{{ cookiecutter.package_name }}" +version = "0.0.1" + +[[tool.streamlit.component.components]] +name = "{{ cookiecutter.import_name }}" +asset_dir = "frontend/build" diff --git a/templates/v2/template-reactless/README.md b/templates/v2/template-reactless/README.md index f60ab3dd..9b01b1a0 100644 --- a/templates/v2/template-reactless/README.md +++ b/templates/v2/template-reactless/README.md @@ -39,9 +39,9 @@ To package this component for distribution: npm run build ``` -2. Build the Python wheel using UV (from the project root with `pyproject.toml`): +2. Build the Python wheel using UV (from the project root): ```sh - uv run --with build python -m build --wheel + uv build ``` This will create a `dist/` directory containing your wheel. The wheel includes the compiled frontend from `my_component/frontend/build`. diff --git a/templates/v2/template-reactless/my_component/pyproject.toml b/templates/v2/template-reactless/my_component/pyproject.toml new file mode 100644 index 00000000..d9954ea2 --- /dev/null +++ b/templates/v2/template-reactless/my_component/pyproject.toml @@ -0,0 +1,7 @@ +[project] +name = "streamlit-custom-component" +version = "0.0.1" + +[[tool.streamlit.component.components]] +name = "my_component" +asset_dir = "frontend/build" diff --git a/templates/v2/template-reactless/pyproject.toml b/templates/v2/template-reactless/pyproject.toml index 22a48225..d935dc3b 100644 --- a/templates/v2/template-reactless/pyproject.toml +++ b/templates/v2/template-reactless/pyproject.toml @@ -9,8 +9,7 @@ description = "Streamlit component that allows you to do X" readme = "README.md" requires-python = ">=3.10" authors = [{ name = "John Smith", email = "john@example.com" }] -# TODO: Restore this -# dependencies = ["streamlit >= 1.51"] +dependencies = ["streamlit >= 1.51"] [project.optional-dependencies] devel = [ @@ -33,7 +32,3 @@ include-package-data = true [tool.setuptools.package-data] my_component = ["frontend/build/**/*", "pyproject.toml"] - -[[tool.streamlit.component.components]] -name = "my_component" -asset_dir = "my_component/frontend/build" diff --git a/templates/v2/template/README.md b/templates/v2/template/README.md index f60ab3dd..9b01b1a0 100644 --- a/templates/v2/template/README.md +++ b/templates/v2/template/README.md @@ -39,9 +39,9 @@ To package this component for distribution: npm run build ``` -2. Build the Python wheel using UV (from the project root with `pyproject.toml`): +2. Build the Python wheel using UV (from the project root): ```sh - uv run --with build python -m build --wheel + uv build ``` This will create a `dist/` directory containing your wheel. The wheel includes the compiled frontend from `my_component/frontend/build`. diff --git a/templates/v2/template/my_component/pyproject.toml b/templates/v2/template/my_component/pyproject.toml new file mode 100644 index 00000000..d9954ea2 --- /dev/null +++ b/templates/v2/template/my_component/pyproject.toml @@ -0,0 +1,7 @@ +[project] +name = "streamlit-custom-component" +version = "0.0.1" + +[[tool.streamlit.component.components]] +name = "my_component" +asset_dir = "frontend/build" diff --git a/templates/v2/template/pyproject.toml b/templates/v2/template/pyproject.toml index 22a48225..d935dc3b 100644 --- a/templates/v2/template/pyproject.toml +++ b/templates/v2/template/pyproject.toml @@ -9,8 +9,7 @@ description = "Streamlit component that allows you to do X" readme = "README.md" requires-python = ">=3.10" authors = [{ name = "John Smith", email = "john@example.com" }] -# TODO: Restore this -# dependencies = ["streamlit >= 1.51"] +dependencies = ["streamlit >= 1.51"] [project.optional-dependencies] devel = [ @@ -33,7 +32,3 @@ include-package-data = true [tool.setuptools.package-data] my_component = ["frontend/build/**/*", "pyproject.toml"] - -[[tool.streamlit.component.components]] -name = "my_component" -asset_dir = "my_component/frontend/build" From c236484630d78fb3e5287c4c4a5ac45a76961d9c Mon Sep 17 00:00:00 2001 From: Bob Nisco Date: Fri, 31 Oct 2025 13:20:15 -0700 Subject: [PATCH 2/2] Add comment --- .../{{ cookiecutter.import_name }}/pyproject.toml | 1 + templates/v2/template-reactless/my_component/pyproject.toml | 1 + templates/v2/template/my_component/pyproject.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml b/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml index fafe5a56..05a46996 100644 --- a/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml +++ b/cookiecutter/v2/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}/pyproject.toml @@ -1,3 +1,4 @@ +# Ship a minimal metadata file that can be picked up by Streamlit at runtime. [project] name = "{{ cookiecutter.package_name }}" version = "0.0.1" diff --git a/templates/v2/template-reactless/my_component/pyproject.toml b/templates/v2/template-reactless/my_component/pyproject.toml index d9954ea2..c1b6f2a0 100644 --- a/templates/v2/template-reactless/my_component/pyproject.toml +++ b/templates/v2/template-reactless/my_component/pyproject.toml @@ -1,3 +1,4 @@ +# Ship a minimal metadata file that can be picked up by Streamlit at runtime. [project] name = "streamlit-custom-component" version = "0.0.1" diff --git a/templates/v2/template/my_component/pyproject.toml b/templates/v2/template/my_component/pyproject.toml index d9954ea2..c1b6f2a0 100644 --- a/templates/v2/template/my_component/pyproject.toml +++ b/templates/v2/template/my_component/pyproject.toml @@ -1,3 +1,4 @@ +# Ship a minimal metadata file that can be picked up by Streamlit at runtime. [project] name = "streamlit-custom-component" version = "0.0.1"