Skip to content

About

complete server written in Python

Resources

Stars

3 stars

Watchers

3 watching

Forks

Latest commit

 

History

110 Commits

Folders and files

Repository files navigation

Overview

hapiserver is a Python HAPI server that uses FastAPI.

(Servers in other languages exist - see also the Java and NodeJS generic HAPI servers.)

To create a HAPI server, a data provider must create four files

  1. config.json
  2. catalog.py with a function that returns /catalog metadata
  3. info.py with a function that returns /info metadata
  4. data.py with a function that returns the /data response

For a new project, we recommend cloning and modifying the demo repository.

Other examples:

Install and Run Demo

git clone https://github.com/hapi-server/server-python-demo
cd server-python-demo
python -m pip install -e .
hapiserver -h
hapiserver --config hapiserver_demo/config.json

Notes

The --config filename is relative to the working directory unless it is absolute. Within the JSON config, relative endpoint script filenames and index.html paths are relative to the config file's directory. Script arguments are passed unchanged by path resolution. If an existing index.html setting relied on the server's working directory, update it to be relative to the config file or use an absolute path.

The last commit of the previous and deprecated version of this repository is commit 834790 and release 0.0.1.

Testing

From the server-python repository root, install the package and development dependencies, then run the tests directly with pytest:

git clone https://github.com/hapi-server/server-python
cd server-python
python -m pip install -e '.[dev]'
python -m pytest -s -v

# Run the Python version test matrix in isolated environments with tox:
python -m tox --stderr-color RESET
# Verbose:
python -m tox --stderr-color RESET -- -s

--stderr-color RESET prevents tox from coloring normal server log output red.

About

complete server written in Python

Resources

Stars

3 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages