This project is a highly opinionated, modern blueprint for building robust, type-safe, and maintainable Python applications using a pragmatic functional approach.
- Type Safety as a Foundation: Every line of code is statically analyzable. The strictest mode of the best tools is the default, not the exception.
- Functional, Not Dogmatic: We use functional concepts (Pipelines, Resulttypes, Immutability) where they improve clarity and maintainability, without sacrificing readability for Python developers.
- AI-Assistant Optimized: A single source of configuration (pyproject.toml) and clearly defined code structures make it easy for AI tools to understand the context and generate high-quality, compliant code.
- Clear Boundaries: We use Pydanticas a robust "shield" that separates the unpredictable outside world (APIs, DBs) from our clean, internal domain logic.
- Modular and Scalable: The structure is designed from the ground up to support various entrypoints (CLI, API, Agent-Loop) that all reuse the same core logic.
- Conda for environment management.
- Poetry for package management.
- Poe the Poet for task management.
# Clone the repository
git clone https://github.com/hoschi/python-starter.git <Your-Project-Name>
cd <Your-Project-Name>Change project name 'py-starter' to <Your-Project-Name> in
- pyproject.toml
- conda.yml
# Create and activate the conda environment
conda env create --file conda.yml
conda activate <Your-Project-Name>
# Install dependencies using Poetry
poetry install
rm -rf .git/
git init
# check the files and add to the `.gitignore` files which you don't want to be in git
echo ".vscode/" >> .gitignore
# remove Rennovate if not needed
rm renovate.json
# add git filter for Jupyter notebooks
nbstripout --install
git add .
git commit -m "init"Die Web-API ist mit FastAPI implementiert und bietet folgende Funktionen:
Starten der API:
poetry run start-apiDadurch wird die Anwendung unter http://localhost:6163 gestartet.
Verfügbare Endpunkte:
- 
GET /users/{user_id}- Gibt einen Benutzer mit der angegebenen ID zurück.
- Antwort: JSON-Objekt mit Feldern id,name,age.
- Beispiel: curl http://localhost:6361/users/1
 
- 
GET /transform/?text=...- Transformiert einen Text (z.B. Normalisierung, Beispiel siehe Code).
- Antwort: JSON mit originalundtransformed.
- Beispiel: curl 'http://localhost:6361/transform/?text=Hallo%20Welt'
 
Fehlerbehandlung:
- Bei nicht gefundenem Benutzer wird ein Fehler 404 zurückgegeben.
- Bei ungültigen Eingaben im Transform-Endpunkt Fehler 400.
Weitere Hinweise:
- Die API nutzt ein In-Memory-User-Repository (nur Demo-Zwecke).
Start the CLI:
poetry run start-cli --helpThis will show you the available commands. For example:
poetry run start-cli get-user 1
poetry run start-cli transform "  Some Text  "This project is equipped with a comprehensive set of quality gates. To run them all locally, use the following commands:
# Run linter and formatter check
ruff check .
ruff format --check .
# Run static type checking
mypy
# Run tests and generate coverage reports
pytest
# Run all checks
poe check-allTo view the interactive coverage report after running the tests, open htmlcov/index.html in your browser.
The docs/ directory contains interactive Jupyter Notebooks. They are the best way to learn the core concepts and patterns used in this project.
- Open the project in VS Code.
- Make sure you have the recommended extensions installed (VS Code will prompt you).
- Select the project's Python interpreter: YOUR CONDA ENV.
- Open docs/01_core_concepts.ipynbordocs/02_advanced_patterns.ipynb.
- Run the code cells one by one to see the concepts in action.
Each code cell ends with assert statements, making the documentation self-verifying.
This project is specifically optimized to work with modern AI coding assistants. To ensure high code quality, we have created a "manifest" for AIs.
Cursor and Gemini are already set up for you.
For other tools: Explicitly include the main directive in your prompt. Example:
claude "Refactor the 'process_data' function in 'src/core/services.py'. Strictly follow the instructions from 'ai-assistants/01-main-directives.md'."The ai-assistants/ directory contains the complete set of rules. The AI is automatically referred to the relevant documents to ensure it always operates within the project's context.