Skip to content

CSCfi/fairdata-metax

Repository files navigation

Metax API

This repository contains the code for Metax API service.

License

Copyright (c) 2018-2020 Ministry of Education and Culture, Finland

Licensed under GNU GPLv2 License

Setting up local development environment

The recommended way to run the development setup is to use Docker-swarm setup. You can also set up the development environment with standalone Docker-containers setup or local install documented below.

Python dependencies

Install Poetry for your OS. Navigate to the repository root and run command poetry install. this will create and activate new Python virtualenv, installing all necessary Python packages to it.

You can generate traditional requirements.txt file with poetry export --dev -E simplexquery -E docs -E swagger --without-hashes -o requirements.txt

Managing dependencies

NOTICE: Please remember to generate the requirements.txt file after any additions, updates or removals using the command above.

Developer dependencies can be added with command poetry add -D <package> Application dependencies can be added with command poetry add <package>

Dependencies can be updated using poetry update. Please notice that this will update all packages and their dependencies, respecting the dependency constraints defined in pyproject.toml

Dependencies can be removed with poetry remove (-D) <package>

Required environmental variables

copy src/metax_api/settings/.env.template as src/metax_api/settings/.env and fill required variables, you can find examples in ENV_VARS.md

Create log directory

mkdir -p /var/log/metax-api/errors

Initial setup commands

Activate your python 3.8 virtualenv, install requirements with pip install -r requirements.txt

cd into src folder and run following command:

python manage.py first_time_setup

start the development server with:

python manage.py runserver 8008

Metax api is available from your browser at http://localhost:8008. To use https refer the ssl-setup.

Running tests

run the tests with command DJANGO_ENV=unittests python manage.py test --parallel --failfast --keepdb -v 0

Running coverage (Docker)

Collect data: docker exec -it -e DJANGO_ENV=unittests $(docker ps -q -f name="metax-web*") coverage run manage.py test --parallel

Combine it: docker exec -it $(docker ps -q -f name="metax-web*") coverage combine

Report: docker exec -it $(docker ps -q -f name="metax-web*") coverage report

Generating coverage report

cli-report:docker exec -it $(docker ps -q -f name="metax-web*") coverage report

Running tests

Run all tests with command DJANGO_ENV=unittests python manage.py test --parallel --failfast

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages