PyML
Python Moonlight (Machine Learning) Practice
Contents
Prerequisites
- Python 3
- Python 3
pip
version 19.0.1 and up - Python 3 built-in virtual env
venv
- System tools: find, rm, tee, xargs, zip (for building, e.g. AWS Lambda package)
- Command line JSON processor: jq
- Docker (optional)
Dev Setup
Running a dev-setup
script to install the project and libraries.
make clean dev-setup # this will create a python virtualenv
Testing
After running make dev-setup
, the project and libraries are installed (in python virtual environment). Now it is able to run tests.
make test # also available to run `make unittest` or `make nosetest`
or to start a clean test (highly recommended before committing changes) -
make clean test-all
and open test coverage report
make show # must be on docker host
Run
API Example
-
run Gunicorn/Flask API in docker container
make run-api
-
run Gunicorn/Flask example in virtual environment (venv)
# start/enable venv (e.g. `source .venv/bin/activate`) make run-gunicorn
-
run Gunicorn/FastApi in venv
# start/enable venv (e.g. `source .venv/bin/activate`) make run-fastapi