Service accepting PDF files containing one or more pages and rendering them to normalized png files.
Technology used:
The easiest way how to install and use the service is to install Docker and Docker Compose. The folder contains docker-compose.yaml that is ready to be used as it is.
To spin up the the docker containers you just need to run this command:
docker-compose up
To check particular log of specific service you can run this command:
docker-compose logs <SERVICE NAME>
The easiest way how to start to use the service is to access the swagger that is generated by FastAPI automatically. With default configuration swagger could be accessed via browser on url address http://localhost:8000/docs
.
To be able to contribute you need to install Python 3 with other tools for local testing and debugging.
- Python 3
- virtualenv (Optional, you can use
venv
if python3 only) - pip-tools (This needs to be installed into virtual environment, not globally)
This section will guide you through setting all prerequisites to start developing and contributing to this project.
$ virtualenv .venv
$ source .venv/bin/activate
Make sure to have some Python3
version running.
$ python3 -m venv .venv
$ source .venv/bin/activate
We use pip-tool
for managing our requirements.txt
files.
There are two main requirements files named as:
• requirements/base.txt- these are base must have packages required to build and deploy this service
• requirements/agent.txt - these are tools used by CI on this repository
After setting the virtual environment, activate it and run following:
$ (.venv) pip install pip-tools
To make sure you are using the pinned dependencies for this project, run the following:
$ (.venv) pip-sync requirements/base.txt
Before adding a new python package, make sure to understand how it is going to be used!. If it is an essential base package required in the service use requirements/base.in. If you are working on CI and you need the tool to be running in there use requirements/agent.in.
Specify your dependency in requirements/base.in
$ (.venv) pip-compile --no-emit-index-url --no-annotate --output-file=requirements/base.txt requirements/base.in
Specify your dependency in requirements/agent.in.
$ (.venv) pip-compile --no-emit-index-url --no-annotate --output-file=requirements/agent.txt requirements/agent.in
Afterwards, make sure to run pip-sync
with the compiled and required .txt
files in requirements folder.
There is a set of unit tests stored in tests/unit as well as integration tests in tests/integration (to be able to run integration tests you need to spin up containers via docker compose). You should add new tests whenever you add any new functionality. To run the tests, simply run:
pytest tests