Skip to main content

Automatically generate Flask servers from Core Data.

Project description

Erlenmeyer allows you to create fully-functional Flask servers, complete with SQLAlchemy models, from a Core Data file.

It’s Flask, SQLAlchemy, and Core Data. Get it? It’s a chemistry pun. Get it?

$ erlenmeyer -p MegaBits -c MBModels.xcodedatamodeld

This command will generate a new Flask project, called MegaBits, with the following directory structure:

MegaBits.py
/handlers
    __init__.py
    ...
/models
    __init__.py
    ...
/settings
    settings.json
/documentation
    MegaBits.html

Where the ellipses (...) are lists of models built from your Core Data file.

Flask File

The Flask file (e.g. MegaBits.py) is the primary Flask service. It creates the Flask app and SQLAlchemy instances, and forwards requests to the handler objects found in the handlers module.

This service has 3 globally accessible variables:

  • settings: A dictionary of settings loaded from settings.json.

  • flaskApp: The Flask app.

  • database: The SQLAlchemy instance, loaded from the Flask app.

handlers

The handlers module contains a separate handler object for each model object built from your Core Data file. Every handler has 5+ methods, depending on the relational complexity of the underlying model.

Each handler method retrieves or applies the appropriate information to its underlying model, and returns a cooresponding flask.Response object, depending on success. In addition, all handler methods are also documented inline.

models

The models module contains object which are created from your Core Data file, and inherit from either flask.ext.sqlalchemy.Model or their Core Data-stated parent class.

settings.json

settings.json contains information for the runtime of the service. The “server” dictionary provides information for the Flask app, such as the IP address and port on which to broadcast. And the “sql” dictionary provides SQLAlchemy login and database information with which it should store the models.

Documentation

The REST API documentation file (e.g. MegaBits.html) is a Twitter Bootstrap-based documentation page. It provides API documentation for each of the URL endpoints laid out in the Flask file.

Other bits…

For feature requests and bug reports, please use https://github.com/MegaBits/Erlenmeyer/issues.

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

Erlenmeyer-0.2.4.tar.gz (12.9 kB view details)

Uploaded Source

File details

Details for the file Erlenmeyer-0.2.4.tar.gz.

File metadata

  • Download URL: Erlenmeyer-0.2.4.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Erlenmeyer-0.2.4.tar.gz
Algorithm Hash digest
SHA256 eac17a3f6bf0fe65c9970c125de7b90b0ff95ab8c138d52786188a3700cddb64
MD5 74355717df823dddd642fb7ba04d41bb
BLAKE2b-256 35cd7f9b32b729191c633eb044751a543a85145e2cdc8c98045293d2072a8271

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