# Windows
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
# Add to PATH
$env:Path += ";$env:APPDATA\Python\Scripts"
# Verify installation
poetry --version# Navigate to backend directory
cd backend
# Generate .env file (if not exists)
python scripts\generate_env.py
# Install dependencies
poetry install
# Run database migrations
poetry run alembic upgrade head# Development mode (with auto-reload)
poetry run uvicorn app.main:app --reload
# Or without auto-reload
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000# Install all dependencies
poetry install
# Install only production dependencies
poetry install --only main
# Install with development dependencies
poetry install --with dev
# Update dependencies
poetry update
# Show installed packages
poetry show# Start development server
poetry run uvicorn app.main:app --reload
# Start with specific host/port
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000
# Start with multiple workers (production)
poetry run uvicorn app.main:app --workers 4
# Start with log level
poetry run uvicorn app.main:app --log-level debug# Run migrations
poetry run alembic upgrade head
# Create new migration
poetry run alembic revision --autogenerate -m "Description"
# Rollback last migration
poetry run alembic downgrade -1
# Check current migration
poetry run alembic current
# Show migration history
poetry run alembic history# Run any Python script
poetry run python scripts/your_script.py
# Run with arguments
poetry run python scripts/generate_env.py --force
# Run interactive
poetry run python scripts/generate_env.py --interactive# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=app
# Run specific test file
poetry run pytest tests/test_auth.py
# Run with verbose output
poetry run pytest -v# Run linter
poetry run flake8 app
# Run type checker
poetry run mypy app
# Run formatter check
poetry run black --check app
# Auto-format code
poetry run black app# Open Python shell with project environment
poetry shell
# Then you can run commands without 'poetry run'
python
>>> from app.core.settings import get_settings
>>> get_settings()Solution:
# Install Poetry
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
# Add to PATH (permanent)
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:APPDATA\Python\Scripts", [System.EnvironmentVariableTarget]::User)Solution:
# Remove existing venv
poetry env remove python
# Create new venv
poetry env use python
# Install dependencies
poetry installSolution:
# Clear cache
poetry cache clear pypi --all
# Update lock file
poetry lock --no-update
# Reinstall
poetry installSolution:
# Make sure you're in backend directory
cd backend
# Activate poetry shell
poetry shell
# Or use poetry run
poetry run python your_script.py# Terminal 1 - Backend
cd backend
poetry shell
python scripts\generate_env.py
poetry run alembic upgrade head
poetry run uvicorn app.main:app --reload
# Terminal 2 - Frontend
cd ..\frontend
npm install --legacy-peer-deps
npm run dev# Terminal 1 - Backend
cd backend
poetry run python scripts\generate_env.py
poetry run alembic upgrade head
poetry run uvicorn app.main:app --reload
# Terminal 2 - Frontend
cd ..\frontend
npm install --legacy-peer-deps
npm run dev# Run automated setup
.\setup_auto.ps1
# Then start
cd backend
poetry run uvicorn app.main:app --reloadbackend/
├── pyproject.toml # Poetry configuration
├── poetry.lock # Locked dependencies
├── .venv/ # Virtual environment (created by Poetry)
├── scripts/
│ ├── generate_env.py # Environment generator
│ └── ...
├── app/
│ ├── main.py # FastAPI application
│ ├── core/
│ │ └── settings.py # Settings (Pydantic)
│ └── ...
└── alembic/ # Database migrations
# Show project info
poetry show
# Show dependency tree
poetry show --tree
# Check for outdated packages
poetry show --outdated
# Add new package
poetry add package-name
# Add dev dependency
poetry add --group dev package-name
# Remove package
poetry remove package-name
# Run any command in virtual environment
poetry run <command>
# Open shell in virtual environment
poetry shell
# Export requirements.txt (for compatibility)
poetry export -f requirements.txt --output requirements.txt# 1. Activate Poetry shell
cd backend
poetry shell
# 2. Run server with auto-reload
poetry run uvicorn app.main:app --reload
# 3. In another terminal, run tests
poetry run pytest tests/ -v
# 4. Check code quality
poetry run flake8 app
poetry run mypy app# Run all tests
poetry run pytest --cov=app
# Check code quality
poetry run flake8 app
poetry run mypy app
poetry run black --check app
# Update lock file if needed
poetry lock --no-update- Poetry Documentation: https://python-poetry.org/docs/
- FastAPI Documentation: https://fastapi.tiangolo.com/
- Project README: ../README.md
- Setup Guide: ../docs/ZERO_CONFIG_SETUP.md
# Check Poetry installation
poetry --version
# Check Python version
python --version
# Check if in backend directory
pwd
ls
# Activate and run
cd backend
poetry shell
poetry run uvicorn app.main:app --reloadThat's it! Poetry makes dependency management easy! 🚀
For more help, see: