Author: Muhammad Hasan
Control Flow Graph Based Notasi Algoritmik Autograder.
This project requires python version 3.9 or later.
(This is mainly because there are many typing hints used in this project, i.e data: dict[str, any]
)
pip install -r requirements.txt
pip freeze > requirements.txt
on windows you might encounter problem when installing pygraphviz, you can solve it by informing pip on where is graphviz installed, e.g.
python -m pip install --global-option=build_ext --global-option="-IC:\Program Files\Graphviz\include" --global-option="-LC:\Program Files\Graphviz\lib" pygraphviz
Luckily, this project does not require many dependencies, so you can simply run this service with Docker.
Once docker
and docker-compose
is installed you can simply run this command on your terminal:
docker-compose up
This will build and run the Dockerfile. If no problems were found, you will see this in your terminal:
...
app_1 | * Serving Flask app "main" (lazy loading)
app_1 | * Environment: production
app_1 | WARNING: This is a development server. Do not use it in a production deployment.
app_1 | Use a production WSGI server instead.
app_1 | * Debug mode: off
app_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Note that even though it says http://0.0.0.0:5000
, the service can only be accessed at http://127.0.0.1:5000
or localhost:5000
.
Now you can check localhost:5000/health-check
to see if it's successfully running or not.
You can also run this on python virtual environment. Follow the steps bellow:
you only need to do this once
python3.9 -m venv .venv
On linux
source .venv/bin/activate
On windows
.venv\Scripts\activate.bat
First off install all the packages first using this command:
python3.9 -m pip install -r requirements.txt
Then run the service by using this command:
PYTHONPATH=$(pwd) python3.9 web_service/src/main.py
You can then try to hit the endpoint localhost:5000/health-check
to see if it's working or not.
deactivate