How lmkihara/python-week-2022 works
Project type and purpose
• This is a minimal Python-based CLI/API tool template (beerlog). It combines:
· A CLI interface (beerlog/cli.py),
· A programmatic REST-style API entrypoint (beerlog/api.py),
· Core business logic (beerlog/core.py),
· A persistence layer (beerlog/database.py, beerlog/models.py),
· Serialization routines (beerlog/serializers.py),
· Config management (beerlog/config.py, beerlog/settings.toml).
• The README confirms it’s a starter template for Python-Week with empty stubs to implement lives’ examples.
File structure
• Top-level: configuration files (pyproject.toml, .flake8, .gitignore, .github/..., .gitpod.yml), a test harness (tests/, conftest.py), and the core package beerlog/.
• In beerlog/:
· __main__.py defines the console script entry (python -m beerlog or beerlog).
· cli.py and api.py expose two different “presentation” layers.
· core.py implements the domain logic (e.g., “log a beer,” “fetch logs”).
· database.py abstracts DB connections/sessions.
· models.py defines ORM/domain entities.
· serializers.py maps domain objects to external representations (JSON, CLI output).
· config.py loads/validates settings from settings.toml.
• Patterns: classic layered architecture (Presentation → Application/Core → Domain/Infrastructure).
README for additional insights
• No hidden microservices or external dependencies beyond standard Python & Poetry.
Detailed capture of essential elements
• Don’t just lump everything under “beerlog.” Show each module as its own component.
• Test suite as a consumer of the Core/Database interfaces.
• Data flow direction clearly (e.g., CLI → Core → Database → Core → Serializers → CLI).