A Sample Python API with Pipenv, Flask, Flask RESTPlus, and PyTest
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests/resources
.env
.gitignore
.python-version
Pipfile
Pipfile.lock
README.md
conftest.py

README.md

Overview

This is a simple Python API boilderplate using Flask and Flask-RESTPlus. It uses Pyenv and Pipenv for runtime and package management. It also uses pytest and pytest-flask for unit testing.

You can find detailed documentation on this boilerplate's set-up here.

Set Up

Install Pyenv following the official installation instructions.

Download the proper python version:

# Installs the version from ".python-version" if not installed 
# Can take some time.
pyenv install

Install pipenv:

pip install --user pipenv

Install all dependencies

pipenv install

Run locally

# If you haven't already, then start a pipenv shell
pipenv shell

PYTHON_ENV=development python src/main.py

Visit Swagger UI on http://localhost:5000/api/swagger.

Run unit tests

# If you haven't already, then start a pipenv shell
pipenv shell

python -m pytest