A streamlit, fast api boilerplate for python development
- Python ≥ 3.11
- Poetry ≥ 2.2.1
- Streamlit ≥ 1.49.1
curl -sSL https://install.python-poetry.org | python3 -
# OR
pip install poetry>=2.2.1poetry config virtualenvs.path /your/desired/pathEnsure below files are configured (create if not exist) properly to run the project;
.env.development.env.production
poetry lock --no-cache --regenerate
poetry install --all-extras --with devOr manually
make installsetup .env.development and .env.production in project root
# for local configuration(linux)
export ENV=development
# for production(linux)
export ENV=productionmake dev
#or with custom port
poetry run sample dev --port 8051
then open UI on : http://localhost:8501
to run on different port use --port option
poetry run sample dev --port 1234make api
#OR with custom port
poetry run sample api --port 5000Access: http://127.0.0.1:5000
Pre-commit hooks are enabled. If commits fail, run:
make lintor run individual
poetry run black .
poetry run flake8 .
poetry run mypy .
poetry run ruff check .poetry clean
poetry buildArtifacts in dist/
- sample-x.y.0-py3-none-any.whl
- sample-x.y.0.tar.gz
python -m venv .venv-dist
source .venv-dist/bin/activate
# Windows
.venv-dist\Scripts\activatepip install dist/*.whl
pip install --upgrade dist/*.whl
# Install extras:
pip install samplemake dev → Launch Streamlit UI
make api → Launch FastAPI
current version will be printed on start of above commands.
these hooks will
- Check for lint and audit for security before commit
- Append branch name in commit message
- Generate requirements.txt on checkout on new branch
# Install git hooks
make hooksthere is .vscode/Python.code-profile file; import this as a profile in vscode which include necessary extension for python development.
sometimes there might be chances that virtual environment get corrupted then delete the old virtual environment and start afresh.
poetry env info
# this will provide virtual environment name
poetry env remove <environment-full-name>