Calculate how much power each of a multitude of different powerplants need to produce (a.k.a. the production-plan) when the load is given and taking into account the cost of the underlying energy sources (gas, kerosine) and the Pmin and Pmax of each powerplant.
- Do not to rely on an existing (linear-programming) solver.
- The focus is on the programming concepts and structures and will be used as a base to discuss all kinds of interesting software engineering topics. You can read the full coding-challenge assignment for more details.
Github star history of FastAPI and some of its siblings: Flask, Django and Django Rest Framework
.
├── app
│ ├── api
│ │ └── routes
│ │ └── v1
│ │ ├── productionplan.py
│ │ └── router.py
│ ├── core
│ │ ├── config.py
│ │ ├── exceptions.py
│ │ └── logging.py
│ ├── main.py
│ ├── middleware.py
│ ├── models
│ │ ├── meritorder.py
│ │ └── powerplants.py
│ ├── schemas
│ │ ├── fuels.py
│ │ ├── powerplant.py
│ │ └── productionplan.py
│ ├── tests
│ │ ├── conftest.py
│ │ └── test_main.py
│ └── utils.py
├── docker-compose.yml
├── Dockerfile
├── logs
├── README.md
└── requirements
├── base.txt
└── local.txt
# update project structure: tree -I '__pycache__|__init__.py|assets/|*.json|example_payloads/|*.log'
This project uses pre-commit hooks to ensure code quality and consistency.
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Run the setup script:
python scripts/setup_dev.py
This will install all development dependencies and set up pre-commit hooks.
You can run pre-commit manually on all files:
pre-commit run --all-files
Or let it run automatically on every commit.
sudo docker compose up -d --build
# or for the older docker versions:
sudo docker-compose up -d --build
Open http://localhost:8899/docs or http://127.0.0.1:8899/docs in your browser.
sudo sudo docker compose dwon -v
# or for the older docker versions:
sudo sudo docker-compose dwon -v
Fast API generates an automatic generated API documentation.
The automatic generated API documentations are also interactive and you can test out the API just in the browser.
This project took a study day and an execution day and was build in the pre copilot and chatGPT era.
This project was done as part of job interview. It was the first time that I used FastApi and the first time I started out a project with Test Driven Development approach. I had lots of fun exploring these new concepts.