Want to start with Streamlit and start using its potential ? First you will need to configure the developement environment on your computer. Let’s do it !
1. System Requirements
- Python: Streamlit recommends Python 3.8 or higher (3.10 is ideal).
2. Install Python and Virtual Environment
- Install Python (if not installed): Download from python.org and follow the installation steps.
- Set up a virtual environment: It helps keep dependencies isolated.bash
python -m venv streamlit_env
source streamlit_env/bin/activate # Linux/macOS
streamlit_env\Scripts\activate # Windows
3. Install Streamlit and Core Libraries
- Streamlit Installation:
pip install streamlit
Additional Libraries: if need :
pip install openai langchain whisper matplotlib pandas
4. Development Workflow
- Editor: Use VS Code or PyCharm for code navigation and integrated terminal.
- Auto-reloading: Streamlit automatically updates when you save files, making it ideal for iterative development.
- Hotkey: Use
Ctrl + Rin the browser to refresh the Streamlit app orCtrl + Cto stop the server in the terminal.
5. Run and Test Streamlit App
- Navigate to your project directory:
streamlit run your_app.py
- Organize pages: Place each page’s code in the
/pagesdirectory (e.g.,pages/about.py,pages/article_generation.py,pages/audio_transcription.py).
6. Streamlit Configuration File (.streamlit/config.toml)
Customize your settings in a .streamlit/config.toml file at your project root. Here are some useful settings:
[server]
headless = true
port = 8501
[theme]
base = "light" # Options: "light" or "dark"
primaryColor = "#1f77b4" # Set primary theme color
[runner]
magicEnabled = false # Disable magic commands to avoid accidental errors
For more tuning see https://docs.streamlit.io/develop/api-reference/configuration/config.toml
