|
| 1 | +# Example application code for the python architecture book |
| 2 | + |
| 3 | +## Chapters |
| 4 | + |
| 5 | +Each chapter has its own branch which contains all the commits for that chapter, |
| 6 | +so it has the state that corresponds to the _end_ of that chapter. If you want |
| 7 | +to try and code along with a chapter, you'll want to check out the branch for the |
| 8 | +previous chapter. |
| 9 | + |
| 10 | +https://github.com/python-leap/code/branches/all |
| 11 | + |
| 12 | + |
| 13 | +## Exercises |
| 14 | + |
| 15 | +Branches for the exercises follow the convention `{chatper_name}_exercise`, eg |
| 16 | +https://github.com/python-leap/code/tree/chapter_04_service_layer_exercise |
| 17 | + |
| 18 | + |
| 19 | +## Requirements |
| 20 | + |
| 21 | +* docker with docker-compose |
| 22 | +* for chapters 1 and 2, and optionally for the rest: a local python3.7 virtualenv |
| 23 | + |
| 24 | + |
| 25 | +## Building the containers |
| 26 | + |
| 27 | +_(this is only required from chapter 3 onwards)_ |
| 28 | + |
| 29 | +```sh |
| 30 | +make build |
| 31 | +make up |
| 32 | +# or |
| 33 | +make all # builds, brings containers up, runs tests |
| 34 | +``` |
| 35 | + |
| 36 | +## Creating a local virtualenv (optional) |
| 37 | + |
| 38 | +```sh |
| 39 | +python3.8 -m venv .venv && source ./venv/bin/activate # or however you like to create virtualenvs |
| 40 | + |
| 41 | +# for chapter 1 |
| 42 | +pip install pytest |
| 43 | + |
| 44 | +# for chapter 2 |
| 45 | +pip install pytest sqlalchemy |
| 46 | + |
| 47 | +# for chapter 4+5 |
| 48 | +pip install requirements.txt |
| 49 | + |
| 50 | +# for chapter 6+ |
| 51 | +pip install requirements.txt |
| 52 | +pip install -e src/ |
| 53 | +``` |
| 54 | + |
| 55 | +<!-- TODO: use a make pipinstall command --> |
| 56 | + |
| 57 | + |
| 58 | +## Running the tests |
| 59 | + |
| 60 | +```sh |
| 61 | +make test |
| 62 | +# or, to run individual test types |
| 63 | +make unit |
| 64 | +make integration |
| 65 | +make e2e |
| 66 | +# or, if you have a local virtualenv |
| 67 | +make up |
| 68 | +pytest tests/unit |
| 69 | +pytest tests/integration |
| 70 | +pytest tests/e2e |
| 71 | +``` |
| 72 | + |
| 73 | +## Makefile |
| 74 | + |
| 75 | +There are more useful commands in the makefile, have a look and try them out. |
| 76 | + |
0 commit comments