wiki/code-style-guide.md
Streamlit uses code auto-formatters and linters on pre-commit. Most of the style-related work is automatically done for you. For everything else, there's this page.
[!NOTE] We have added development guides for different parts of the Streamlit codebase. While written primarily for AI agents, these guides are also helpful for human developers.
We use PEP8 style for Python code, with a few adjustments:
_ if it's only used inside that module. (That is, anything private must start with _)The main principle here is "anything the user may want to be able to easily pipe
into a file / another process should go into stdout, everything else
stderr".
This means you should always have logs, warnings, errors, and notices end up in
stderr. Never stdout.
We use the AirBNB style for JavaScript and TypeScript.
Before adding a new JS dependency, check that the license is compatible with Apache 2.0.
styled-components.ts file.
Styled to indicate it's a styled component.theme parameter (in addition to any props). The theme argument will be equivalent in structure to the main theme. Use the proper values that match the color/spacing/sizing/font style you are looking for.useEmotionTheme and use those values in overrides.If you need to add image assets, fonts, etc, first check with Streamlit developers so we can look at the license. If all is good, you'll still need to add a line to the update-notices rule in our Makefile, and rerun make update-notices.