Skip to main content

flask-ligand-example

Build PyPI Codecov pre-commit

A simple example project on how to use the flask-ligand library. This example project is based on the example from the flask-smorest project. (Which is a core library that flask-ligand is built upon)

Quick Start Guide

Follow the instructions below to start exploring this example project!

Prerequisites

Clone Repo

$ git clone git@github.com:cowofevil/flask-ligand-example.git

Make Targets

Execute the following command to get a full list of make targets:

$ make help

Setup Python Environment

  1. Create a Python virtual environment:

    $ mkvirtualenv -p py310 flask-ligand-example
  2. Setup develop environment:

    $ make develop-venv
  3. Setup git pre-commit hooks:

    $ make setup-pre-commit
  4. Verify that environment is ready for development:

    $ make test-tox

Setup Docker Environment

The included docker environment used for integration testing can also be used for exploring the example project as well!

  1. Setup the Docker environment:

    $ make setup-integration
  2. Verify that the Docker environment is ready:

    $ make check-integration
  3. (Optionally) Execute the integration tests:

    $ make test-integration

Explore with SwaggerUI Docs

This example project has all the bells and whistles enabled for the flask-ligand library which can be explored by using the included SwaggerUI documentation. Follow the instructions below to start start running a local Flask server to serve the SwaggerUI documentation.

  1. Generate a ‘.env’ file to configure Flask server to use the included Docker environment:

    $ make gen-local-env-file
  2. Initialize the database:

    $ make setup-db
  3. Generate a JWT access token with admin rights for accessing the included example project endpoints:

    $ make gen-admin-access-token
  4. Start the local Flask server:

    $ make run
  5. Open a browser and navigate to ‘http://localhost:5000/apidocs’.

  6. Click the ‘Authorize’ button and paste in the JWT access token you created previously.

Now go ahead and start playing around with the API!

Access Keycloak Admin Console

If you would like to make changes to the Keycloak IAM clients to explore authentication then you can access the admin console by navigating to ‘http://localhost:8080/admin/master/console/’. The admin credentials can be found in the ‘docker/env_files/integration.env/’ file.

Flask-Migrate Auto-generation

For Flask-Migrate to work well when auto-generating migration scripts it is critical that the script.py.mako template in the migrations folder include an import for sqlalchemy_utils. This project already has the template updated, but if you are using the flask-ligand library without copying this example project, then it is necessary you make the appropriate update to the script.py.mako template before using Flask-Migrate.

Resources

Metadata

Release files for flask-ligand-example 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-ligand-example 0.5.2
File Size Uploaded
flask-ligand-example-0.5.2.tar.gz 53.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-ligand-example 0.5.2
File Interpreter ABI Platform
flask_ligand_example-0.5.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 75.3 kB

Release files / flask-ligand-example-0.5.2.tar.gz

Download URL flask-ligand-example-0.5.2.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c25e474d013d4036512b0d8a326887c976ca4ac1913f66b5d42d89f2e60e99c2
BLAKE2b-256 checksum
How to use checksums
695a6db8b8389ea3889c9883f019349bf4c22f8b352f221309b36c5c91200a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11

Release files / flask_ligand_example-0.5.2-py2.py3-none-any.whl

Download URL flask_ligand_example-0.5.2-py2.py3-none-any.whl
Size 21.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1c064fa180de0a11a4a79f4cd10e731bae0e583bbec35b8898472bc6ead5d56d
BLAKE2b-256 checksum
How to use checksums
dc58c439a29f610e2db5b8341e3ff4301f8c858164f7a47087d521a5f3f994d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page