The default branch, main, was created from the upstream
start tag.
-
7. Aggregates and Consistency Boundaries
-
8. Events and the Message Bus
-
9. Going to Town on the Message Bus
-
10. Commands and Command Handler
-
11. Using Events to Integrate Microservices
-
12. Command-Query Responsibility Separation
-
13. Dependency Injection
git clone git@github.com:evokateur/python-architecture.git
cd python-architecture
pyenv shell 3.12
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file based on .env.example:
cp .env.example .envYou have two options for running the application:
Edit .env and set your Railway PostgreSQL connection string:
POSTGRES_URI=postgresql://user:password@host:port/databaseOther important settings in .env:
FLASK_RUN_PORT=5005(default port for local Flask)FLASK_APP=entrypoints/flask_app.pyFLASK_ENV=development
Use the default values from .env.example (no changes needed). Docker Compose will run both PostgreSQL and the Flask app in containers.
Add semi-upstream† remote for reference
† a fork I will test the chapter branches in, but not code along in
git remote add upstream git@github.com:evokateur/python-architecture-code.git
git fetch upstreamgit branch -r -l 'upstream/chapter_07*'Start the Flask development server (connects to Railway PostgreSQL):
make flaskStop the Flask server:
make unflaskCheck Flask logs:
cat flask.logStart all services (PostgreSQL + Flask in containers):
make upStop all services:
make downView logs:
make logs# Run all tests
make test
# Run specific test types
pytest tests/unit --tb=short
pytest tests/integration --tb=short
pytest tests/e2e --tb=short
# Watch tests during development
make watch-testsmake black