Skip to content

Service accepting PDF files containing one or more pages and rendering them to normalized png files.

Notifications You must be signed in to change notification settings

ondrejtomas/pdf-rendering-service

Repository files navigation

About

Service accepting PDF files containing one or more pages and rendering them to normalized png files.

Technology used:


Table of Contents


Quick Start

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.

Prerequisites

Installation

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>

Usage

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.


How To Contribute

To be able to contribute you need to install Python 3 with other tools for local testing and debugging.

Prerequisites

  • Python 3
  • virtualenv (Optional, you can use venv if python3 only)
  • pip-tools (This needs to be installed into virtual environment, not globally)

Installation

This section will guide you through setting all prerequisites to start developing and contributing to this project.

1. Setup virtualenv or venv

virtualenv option
$ virtualenv .venv
$ source .venv/bin/activate
venv option

Make sure to have some Python3 version running.

$ python3 -m venv .venv
$ source .venv/bin/activate

2. Setup pip-tool for dependency management

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

3. Syncronizing requirements files

To make sure you are using the pinned dependencies for this project, run the following:

$ (.venv) pip-sync requirements/base.txt
What if I want to add a new dependency?

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.

My package is a base dependency

Specify your dependency in requirements/base.in

$ (.venv) pip-compile --no-emit-index-url --no-annotate --output-file=requirements/base.txt requirements/base.in
My package is needed in CI

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.


Testing

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

About

Service accepting PDF files containing one or more pages and rendering them to normalized png files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published