https://github.com/cosmicpython/code
Example application code for the python architecture book
https://github.com/cosmicpython/code
Last synced: 8 months ago
JSON representation
Example application code for the python architecture book
- Host: GitHub
- URL: https://github.com/cosmicpython/code
- Owner: cosmicpython
- License: other
- Created: 2019-02-05T10:12:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-01T20:50:39.000Z (over 1 year ago)
- Last Synced: 2025-04-11T14:16:52.570Z (9 months ago)
- Language: Python
- Size: 536 KB
- Stars: 2,315
- Watchers: 50
- Forks: 1,013
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
- stars - cosmicpython/code - Example application code for the python architecture book (Python)
README
# Example application code for the python architecture book
## Chapters
Each chapter has its own branch which contains all the commits for that chapter,
so it has the state that corresponds to the _end_ of that chapter.
If you want to try and code along with a chapter,
you'll want to check out the branch for the previous chapter.
https://github.com/cosmicpython/code/branches/all
## Exercises
Branches for the exercises follow the convention `{chapter_name}_exercise`,
eg https://github.com/cosmicpython/code/tree/chapter_04_service_layer_exercise
## Requirements
* docker with docker-compose
* for chapters 1 and 2, and optionally for the rest: a local python3.8 virtualenv
## Building the containers
_(this is only required from chapter 3 onwards)_
```sh
make build
make up
# or
make all # builds, brings containers up, runs tests
```
## Creating a local virtualenv (optional)
```sh
python3.8 -m venv .venv && source .venv/bin/activate # or however you like to create virtualenvs
# for chapter 1
pip install pytest
# for chapter 2
pip install pytest sqlalchemy
# for chapter 4+5
pip install -r requirements.txt
# for chapter 6+
pip install -r requirements.txt
pip install -e src/
```
## Running the tests
```sh
make test
# or, to run individual test types
make unit-tests
make integration-tests
make e2e-tests
# or, if you have a local virtualenv
make up
pytest tests/unit
pytest tests/integration
pytest tests/e2e
```
## Makefile
There are more useful commands in the makefile, have a look and try them out.