This is my solution for Wolt Summer 2023 Engineering Intern assignment. The purpose of this app is to determine the delivery price for customer.
- This solution was built using Python.
- Calculations for delivery fee run in O(1) time complexity.
- Poetry for managing dependencies and packaging.
- Invoke for automating tasks on command line.
- FastAPI library to construct an HTTP API.
- NumPy and datetime to calculate the delivery fees.
- Mypy for checking typing.
- Flake8 for code analyzing
- Black for auto-formatting.
- Unittest for testing.
- Continuous integration is enabled by Github Actions.
- Additional validations have been implemented:
- The values for cart_value, delivery_distance, and amount_of_items must be positive numbers (greater than 0) and the input data must be in a proper format for all variables. → If the input data is of an incorrect type, an error message will be displayed.
- Python 3.9 or later
- Poetry
Install the dependencies:
poetry install
Activate the poetry environment:
poetry shell
Run the server:
poetry run invoke start
The API documentation is available at http://127.0.0.1:8000/docs.
100% of the code has been tested. Below is a screenshot of the coverage report and commands to run and view the tests.
Test the app:
poetry run invoke test
Create coverage html:
poetry run invoke coverage
Get coverage report:
poetry run invoke coverage-report
View report on Firefox browser:
poetry run invoke coverage-view
Check typing:
poetry run invoke mypy
Generate a code analysis:
poetry run invoke flake
Auto-format the code
poetry run invoke black