Skip to main content

A HTTP REST API to work with the HPO Ontology

Project description

A HTTP REST-API wrapper for PyHPO

Main features

This package allows an easy setup of a REST API to interact with HPO Terms using the PyHPO package.

API Documentation

The REST API is also fully documented: https://centogene.github.io/pyhpoapi

To see an interactive API documentation, install PyHPO-API, run the app and visit http://127.0.0.1:8000/docs

Installation / Setup

The easiest way to install PyHPO-API is via pip

pip install pyhpoapi

Usage

Getting started

The easiest way to get started is to run the API via

uvicorn pyhpoapi.main:app

Parallel processing

If you want better performance for parallel request handling, you can run PyHPO-API with multiple workers

uvicorn pyhpoapi.main:app --workers 15

Note

Don’t use more workers than available CPUs as it will backfire and slow down processing due to constant context-switches

CORS

If you need to allow cross-origin requests, you can simply create a config.ini file in your working directory and specify CORS settings:

[default]
cors-origins = *
cors-methods = GET,POST
cors-headers = *

Dev

Getting started for development

Clone the repository

git clone https://github.com/anergictcell/pyhpoapi.git
cd pyhpoapi

Use Docker for development

One way to do this is to run a docker container during development

docker run --rm -v $(pwd):/src -p 8000:8000 -it python:3.9-slim-buster bash

cd src
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

python3 -m unittest discover tests

uvicorn --host 0.0.0.0 --reload pyhpoapi.main:app

Or local development without Docker

Create a virtual environment and install requirements in the virtual environment

virtualenv --python pyhon3 venv_pyhpoapi
source venv_pyhpoapi/bin/activate

pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

python3 -m unittest discover tests

uvicorn --reload pyhpoapi.main:app

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhpoapi-1.2.2.tar.gz (43.8 kB view hashes)

Uploaded source

Built Distribution

pyhpoapi-1.2.2-py3-none-any.whl (43.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page