Skip to content

Latest commit

 

History

History
84 lines (58 loc) · 2.16 KB

DEVELOPMENT.md

File metadata and controls

84 lines (58 loc) · 2.16 KB

tsd-file-api development

Setting up the development environment

pip install poetry pre-commit
poetry self add "poetry-dynamic-versioning[plugin]"
git clone https://github.com/unioslo/tsd-file-api.git
cd tsd-file-api
poetry install
pre-commit install

Running the file API for local testing

poetry run tsd-file-api

Running tests locally

While the file API is running on your machine, run this in a separate terminal:

poetry run python tsdfileapi/test_file_api.py

Alternative container based development setup

Running the file API in a container for local testing

The repository provided Makefile can be used to run a local server to develop against:

make run

The container engine used to build and run this container defaults to Podman. If you wish to use Docker instead, you can set CONTAINER_ENGINE=docker:

make run CONTAINER_ENGINE=docker

This container image will include all dependencies needed to run the file API, except for the file API itself. The repository root gets mapped to /file-api inside of the container when ran.

You can develop normally on your host system, and the Tornado Web Server process inside of the container will pick up changes and reload when needed.

The test container only needs to be rebuilt when project dependencies change, so even though a build is triggered with every make run, container layer caching will speed past this step unless any actual work is needed.

Running tests in the container

The repository provided Makefile can be used to run through the package's included test set in the running container:

make tests

As when running the API, set CONTAINER_ENGINE=docker if using Docker.

Reference API client

Installing the API will also install the reference command-line client, tsd-api-client (tacl).

You can use it with the dev instance as such:

tacl p11 --env dev

See tacl --help for more usage notes.