You may start the server locally or using a docker container, the requirements for each setup are listed below.
Make sure you have all requirements installed on your computer. Then, you may start the server using either a Docker container or in your local machine.
Export these environment variables:
export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
(Optional) Start a MinIO instance:
docker run -d -p 9000:9000 \
--name minio \
--env "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
--env "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
minio/minio:RELEASE.2018-02-09T22-40-05Z \
server /data
Then, build a docker image that launches the API server:
docker build -t platiagro/datasets:0.3.1 .
Finally, start the API server:
docker run -it -p 8080:8080 \
--name datasets \
--env "MINIO_ENDPOINT=$MINIO_ENDPOINT" \
--env "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
--env "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
platiagro/datasets:0.3.1
Export these environment variables:
export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
(Optional) Create a virtualenv:
virtualenv -p python3 venv
. venv/bin/activate
Install Python modules:
pip install .
Then, start the API server:
uvicorn datasets.api:app
Arguments:
usage: uvicorn datasets.api:app [-h] [--host TEXT] [--port INTEGER] [--workers INTEGER]
Datasets API
optional arguments:
-h, --help show this help message and exit
--host TEXT Bind socket to this host (default: 127.0.0.1)
--port INTEGER Port for HTTP server (default: 8000)
--workers INTEGER Number of worker processes.
environment variables:
ENABLE_CORS whether to enable CORS headers for all responses.
Install the testing requirements:
pip install .[testing]
Export these environment variables:
export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
Use the following command to run all tests:
pytest
Use the following command to run lint:
flake8 --max-line-length 127 datasets/
See the PlatIAgro Datasets API doc for API specification.