Skip to content

Latest commit

 

History

History
144 lines (96 loc) · 2.95 KB

File metadata and controls

144 lines (96 loc) · 2.95 KB

RZ-Sample

PyPI - Python Version pypi License Publish

poetry + streamlit + fast api boilerplate for python development.

Installation Guide

Prerequisites

  • Python ≥ 3.11
  • Poetry ≥ 2.2.1
  • Streamlit ≥ 1.49.1

Getting Started

Poetry Setup

curl -sSL https://install.python-poetry.org | python3 -
# OR
pip install poetry>=2.2.1

Virtual Environment Configuration

poetry config virtualenvs.path /your/desired/path

Ensure below files are configured (create if not exist) properly to run the project;

  • .env.development
  • .env.production

Install Dependencies

poetry lock --no-cache --regenerate
poetry install  --all-extras --with dev

Or manually

make install

How to Run

Configure ENVIRONMENT

setup .env.development and .env.production in project root

  # for local configuration(linux)
  export ENV=development
  # for production(linux)
  export ENV=production

Run Streamlit App

make 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 1234

Run FastAPI Server

make api
# OR with custom port
poetry run sample api --port 5000

Access: http://127.0.0.1:5000

🧹 Linting & Code Quality

Pre-commit hooks are enabled. If commits fail, run:

make lint

or run individual

poetry run black .
poetry run flake8 .
poetry run mypy .
poetry run ruff check .

CLI Shortcuts

make dev → Launch Streamlit UI

make api → Launch FastAPI

current version will be printed on start of above commands.

Troubleshooting

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>

License

MIT

References