Skip to main content

A simple example project on how to use the flask-ligand library.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-ligand-example-0.5.2.tar.gz (53.3 kB view details)

Uploaded Source

Built Distribution

flask_ligand_example-0.5.2-py2.py3-none-any.whl (21.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file flask-ligand-example-0.5.2.tar.gz.

File metadata

  • Download URL: flask-ligand-example-0.5.2.tar.gz
  • Upload date:
  • Size: 53.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for flask-ligand-example-0.5.2.tar.gz
Algorithm Hash digest
SHA256 c25e474d013d4036512b0d8a326887c976ca4ac1913f66b5d42d89f2e60e99c2
MD5 bd39ae536021731180db9c274d6dafeb
BLAKE2b-256 695a6db8b8389ea3889c9883f019349bf4c22f8b352f221309b36c5c91200a95

See more details on using hashes here.

File details

Details for the file flask_ligand_example-0.5.2-py2.py3-none-any.whl.

File metadata

  • Download URL: flask_ligand_example-0.5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for flask_ligand_example-0.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c064fa180de0a11a4a79f4cd10e731bae0e583bbec35b8898472bc6ead5d56d
MD5 c3e94226ffd997b19854a4909a8662bb
BLAKE2b-256 dc58c439a29f610e2db5b8341e3ff4301f8c858164f7a47087d521a5f3f994d7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page