Skip to content
/ sdk Public template

The SDK provides the infrastructure for creating microservices which encapsulate all setup code for running a Flask based web application.

Notifications You must be signed in to change notification settings

PyBackendBoilerplate/sdk

Repository files navigation

PyBackendBoilerplate Software Development Kit (SDK)

Development status: WIP

This package encapsulate all of the common infrastructure required to implement a Flask based microservice with support for OpenAPI 3 and Connexion out-of-the-box.

The SDK is part of the PyBackendBoilerplate package and is used in the example micro-service boilerplate project under that package.

Tech Stack

The package is tested on Python 3.8, but Python 3.7 should also work (minimum version though).

The following list describes part of the stack used in the SDK:

Configurations

The SDK also supports loading configurations from the following options:

By default, it will first try to load the .env and .flaskenv files. If N/A, it will use the defaults defined in the code (Notice: There aren't defaults for everything, just the minimum required to run on host and port per defined in the defaults).

To access these values, use class ConfigBase and class Environment, e.g:

# This will automatically try to load the environment configurations 
# and return a built Environment object.
env: Environment = ConfigBase().active_env

Gunicorn

When running with gunicorn, you can use defaults from the src/sdk/config/gunicorn_conf.py. To override them, just create your own gunicorn_conf.py file like this and use that when running gunicorn:

import sys
import os

sys.path.append(os.path.join(sys.path[0], 'src'))
from sdk.config.gunicorn_conf import *

# override default sdk values here

bind = '0.0.0.0:5555'

Examples

The SDK comes with built-in examples under src/examples which shows how to use the SDK to build the official examples of Flask and Connexion with the SDK's infrastructure.

Development

The SDK is developed in VS Code and provides a .vscode directory with predefined settings to get your VS Code environment ready fast.

Coding Style

The coding style format is according to Google Python Style Guide.

The coding style is automatically formatted with yapf and configured for Google coding style by default. To see the full configurations, check the .style.yapf configuration file.

The documentation is also configured via the provided .vscode settings to Google coding style by default.

References

Thanks sections for projects which helped me develop this one:

About

The SDK provides the infrastructure for creating microservices which encapsulate all setup code for running a Flask based web application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published