Guidelines and workflows for developing the Book Lamp application, focusing on the Google Sheets adapter pattern and project philosophy.
This skill provides comprehensive guidelines for developing, maintaining, and extending the Book Lamp application.
Following the Python Architecture Tutor principles, we prioritise clarity, readability, and explicit structure:
The project is structured into distinct layers to separate business logic from external side effects:
book_lamp/services/. PostgresStorage is our primary adapter for PostgreSQL.book_lookup.py).app.py and CLI commands.serialise, colour, optimise).datetime.now(timezone.utc), pathlib).src/ts/. Never edit the compiled .js files in book_lamp/static/.book_lamp/static/.<style> blocks in HTML templates. Use descriptive filenames (e.g., base.css, books.css).def function_name(param1: str) -> bool:
"""Short summary of the function.
Detailed description if necessary.
Args:
param1: Description of param1.
Returns:
Description of the return value.
"""
The PostgresStorage class in book_lamp/services/postgres_storage.py is the primary adapter for data.
id, isbn13, title, author, publication_year, thumbnail_url, created_atid, book_id, status, start_date, end_date, rating, created_atid, email, created_atid, user_id, book_id, created_atid, user_id, key, value, created_atid, user_id, book_id, reason, created_atalembic/ directory.alembic upgrade head to apply migrations.alembic revision --autogenerate -m "description" to create new migrations.alembic revision --autogenerate -m "Add new table"PostgresStorage class methods to handle new columns/tables.alembic upgrade head and alembic downgrade -1.Refer to the Testing skill for standards and patterns. All code must be verified with simple, high-coverage unit tests in the tests/ directory.
GOOGLE_CLIENT_ID is needed..env files or credentials.SECRET_KEY: For Flask session management.DATABASE_URL: PostgreSQL connection string.GOOGLE_CLIENT_ID: Optional Google One Tap Client ID.DATABASE_URL is correct and database is accessible.alembic upgrade head to ensure schema is current.mise install, then poetry install for backend and npm install for frontend..env.example to .env and fill in DATABASE_URL and optional GOOGLE_CLIENT_ID.podman-compose up -d to start PostgreSQL, then poetry run alembic upgrade head.npm run build to compile TypeScript to JavaScript.poetry run flask --app book_lamp.app run --debug.feat:, fix:, refactor:, docs:).mise (manages Python, Node, and Poetry versions)poetry run) and NPM (npm install)npm run build) via tsc.black, isortruff, mypy (strict mode), tsc (strict mode)pytest (backend) and vitest (frontend)