Based on a CanDIG OpenAPI variant service demo, this toy service demonstrates the Python OpenAPI stack with CanDIG API best practices.
- Connexion for implementing the API
- SQLAlchemy, using Sqlite3 for ORM
- Bravado-core for Python classes from the spec
- Dredd and Dredd-Hooks-Python for testing
- Python 3
- Pytest, tox
- Travis-CI
The server software can be installed in a virtual environment:
pip install -r requirements.txt
pip install -r requirements_dev.txt
python setup.py develop
for automated testing you can install dredd; assuming you already have node and npm installed,
npm install -g dredd
The server can be run with, for instance
python3 -m python_model_service --database=test.db --logfile=test.log --loglevel=WARN
For testing, the dredd config is currently set up to launch the service itself, so no server needs be running:
cd tests
dredd --hookfiles=dreddhooks.py