Skip to content

[feat] Add @streamlit/component-v2-lib package#12626

Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack
Sep 26, 2025
Merged

[feat] Add @streamlit/component-v2-lib package#12626
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Sep 24, 2025

Describe your changes

  • This bootstraps the @streamlit/component-v2-lib package, which will be used by CCv2 authors and internally by our frontend implementation.
  • The contents here are mostly just TypeScript types, plus the necessary packaging infra.
  • It is not actually used anywhere in the existing Streamlit code yet, but will be later!

GitHub Issue Link (if applicable)

Testing Plan

  • This is mostly types, so it is checked by the frontend type checks.
  • I did add a small vitest suite, but there isn't anything that useful in there yet.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Sep 24, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 24, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12626/streamlit-1.50.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12626.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Copy Markdown
Collaborator Author

sfc-gh-bnisco commented Sep 24, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sfc-gh-bnisco sfc-gh-bnisco added change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed labels Sep 24, 2025 — with Graphite App
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR bootstraps the @streamlit/component-v2-lib package, which provides TypeScript types and infrastructure for Streamlit Components v2 authors. This package establishes the foundation for the upcoming CCv2 (Custom Components v2) feature by defining type interfaces, theme properties, and packaging infrastructure.

  • Adds a new TypeScript package with component type definitions and theme interfaces
  • Integrates the package into the existing monorepo workspace structure
  • Sets up build infrastructure and CI/CD processes for package distribution

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/component-v2-lib/src/types.ts Core TypeScript type definitions for component arguments, state, and function signatures
frontend/component-v2-lib/src/theme.ts TypeScript interfaces for Streamlit theme properties and CSS custom properties
frontend/component-v2-lib/package.json Package configuration with build scripts, dependencies, and npm publishing settings
frontend/component-v2-lib/vite.config.ts Vite build configuration for library bundling and testing setup
frontend/package.json Workspace configuration to include the new component-v2-lib package
.github/workflows/pr-preview.yml CI workflow updates to build and distribute the npm package
scripts/check_license_headers.py License header exclusion pattern for yarn cache directory
Makefile Clean target updated to remove component-v2-lib build artifacts
NOTICES License notice addition for the new package

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated no new comments.

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review September 25, 2025 16:28
@sfc-gh-bnisco sfc-gh-bnisco requested a review from a team as a code owner September 25, 2025 16:28
@sfc-gh-bnisco sfc-gh-bnisco added impact:internal PR changes only affect internal code and removed impact:users PR changes affect end users labels Sep 25, 2025

type ComponentCleanupFunction = () => void

export type ComponentResult = ComponentCleanupFunction | void
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] Will ComponentResult always be used for cleanup, or will it also be possible for the component to return a result?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will always be used for (optional) cleanup.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the name a bit misleading then, it's a [nit], but I wonder if there is a better name. I would suggest inlining this, but I see it's exported so that is likely why it has its own name to make it easier to keep consistent.

Maybe OptionalComponentCleanupFunction?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I've updated the name of this and added more comprehensive JSDocs per our discussion throughout this PR.

@sfc-gh-bnisco sfc-gh-bnisco merged commit 66a9acf into develop Sep 26, 2025
39 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the bnisco/ccv2-stack branch September 26, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:internal PR changes only affect internal code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants