The 5 Minute Streamlit Project Setup with uv
A Micro SaaS Build Part 0

I'm a data analyst with development and graphic design experience. I know how to build a website from scratch, but I sometimes work with entrepreneurs and small businesses with their Wix or Squarespace sites, so basically I help them to establish their online presence. When I'm not doing that, I'm studying and blogging about data engineering, data science or web development.
Using Astral’s uv has been a timesaver! Instead of manually having to setup Git and my virtual environment, uv does it all for me. So here’s how to do it step by step or feel free to watch the Youtube video at the end.
How to setup uv
Create a new local directory and open it in VSCode.
- Open a terminal window in VSCode (Windows hotkey:
Ctrl + `).
- Open a terminal window in VSCode (Windows hotkey:
Make a new directory to store your program:
mkdir your-project-nameGo into the new directory:
cd your-project-nameInstall uv (https://docs.astral.sh/uv/). Make sure this is done in a Python environment that's in your system's $PATH. Otherwise, you won't be able to run uv in the terminal.
Run
uv initin the terminal. A bunch of files should be automatically added to the directory, and git is initialised.To see all the files in your directory, including the hidden ones, you should see all the files that uv added your git repository files/directory and your README file, use:
ls -a- uv should have added your git repository
Add the files to the repository:
git add .- You should not see the
.envfile or the virtual environment directory.venvin the list of files and directories that Git will add to the repository, because uv has already added those to the.gitignorefile!
- You should not see the
Commit this state as an initial commit in git, and publish to Github.
Commit it:
git commit -m "Initial commit"Check the git status again and then look at the git log to see your first commit:
git logYou should see the message with the commit id, author and date with the commit message:
commit 65b992794c181fbf065eabe682a58de46adf3c89 Author: Your Name <yourname@somedomain.com> Date: Sat Jul 19 11:02:03 2025 -0700 Initial commit
The repo will need to be public in order for it to be deployed to Streamlit Community Cloud. Or you can keep it private to deploy to Render.
If you create the repo via Github, initialise it empty (without a README file, for example), because uv should have added this file.
Activate it your virtual environment:
Mac:
source .venv/bin/activatePC:
.venv\Scripts\activateYou should see your command line prompt change to have some like the following:
(.venv) your path %
Run
main.pyin terminal using the commanduv runmain.py.- This should create the environment using
uv, including the creation of a.venvsubdirectory (containing a newly created vitual environment for your project) and auv.lockfile in the root directory (which specifies your project's dependencies).
- This should create the environment using
Add
streamlitto your virtual environment by runninguv add streamlitin the terminal. Streamlit and its dependencies should all be added to the virtual environment, thepyproject.tomlfile and theuv.lockfile. You can install other dependencies in this way as well (just like usingpip install).Check that everthing is working by:
- Modifying
main.pyto use streamlit
- Modifying
import streamlit as st
def main():
st.header("Hello from your-project!")
if __name__ == "__main__":
main()
Activating the virtual environment in terminal by running
.venv\Scripts\activate.Running
main.pyusing streamlit in the terminal with the commandstreamlit runmain.py. The streamlit app should launch in you browser and display as expected.To stop running the app, use
Ctrl + Cin the terminal. This will allow you to continue running other commands in terminal (you will have to close the browser manually though).
Watch the video instead
In my next article, I’ll detail how to set up your repo as a Python package to make it easier to organize your code.




