Package: ct-core-api
CT Core API – Catalant Core API Framework.This framework enables developers to easily build and testFlask web applicationsthat expose aRESTful API.It is composed from a number of Python libraries and projects, most notably:Web FrameworkFlaskhttp://flask.pocoo.org/Flask –0.11http://flask.pocoo.org/docs/0.11/webargs –1.4http://webargs.rtfd.org/Database / ORMSQLAlchemyhttp://www.sqlalchemy.org/CT-Core-DBhttps://github.com/Catalant/ct-core-db/Object SerializationMarshmallow –2.10http://marshmallow.readthedocs.io/en/latest/Flask-Marshmallow –0.7https://flask-marshmallow.readthedocs.io/en/latest/Marshmallow-SQLAlchemy –0.12http://marshmallow-sqlalchemy.rtfd.org/REST / SwaggerSwagger (OpenAPI Specification)https://github.com/OAI/OpenAPI-SpecificationSwagger-UIhttps://github.com/swagger-api/swagger-uiFlask-RESTful –0.3http://flask-restful.readthedocs.io/en/0.3.1/apispec –0.16http://apispec.rtfd.org/Authentication / Authorizationoauthlib –2.0http://oauthlib.rtfd.org/)flask-oauthlib –0.9http://flask-oauthlib.rtfd.org/flask-login –0.3http://flask-login.rtfd.org/permission –0.4https://github.com/hustlzp/permissionbcrypt –3.1https://github.com/pyca/bcrypt/Distributed In-Memory Cachememcachedhttps://memcached.org/Dogpile-Cache –0.6http://dogpilecache.readthedocs.io/en/latest/usage.htmlFlask-Dogpile-Cache –0.2https://bitbucket.org/ponomar/flask-dogpile-cacheDistributed Task QueueRabbitMQhttps://www.rabbitmq.com/Celery –3.1http://www.celeryproject.org/Requirementspython2.6+,3.3+/ pypy2 (2.5.0)InstallationCT Core APIis hosted on our internalPyPi repository. It should be installed using pip:pip install ct-core-apiUsagePlease see theDemo API Applicationfor a fully functioning example that demonstrates the setup and usage of the
framework components.Getting StartedThis is how to create and register an API in your project:"""catalant/example/app/__init__.py"""

from ct_core_api.api import core
from ct_core_api.api.app import create_api_app

# TODO: Revise this example for 2.0Here is what your application’s main entry point should look like:"""catalant/example/app/main.py"""

#!/usr/bin/env python

from catalant.example.app import create_example_api_app


app = create_example_api_app()


if __name__ == '__main__':
    from ct_core_api.api.app import runner
    runner.run(app)Structuring the entry point as such allows us to invoke and run the Flask application as an executable script,
directly using Flask’s development server, or using a uwsgi web server.ChangelogEvery API application has it’s own changelog. Developers are expected to update the changelog anytime a functional or
structural change to the API occurs.“Keep a CHANGELOG” has a good set of guiding principles for when and how a changelog should be maintained.By default, the API’s changelog is accessible at/changelogand the entries live inchangelog.ymlin the
application’s root folder (APIApp.root_path).You can modify the path to this file using theAPI_CHANGELOG_PATHconfig setting.FormatThe changelog file uses the following YAML format:---                                            # Separate changelog entries by date
<yyyy-mm-dd>:                                  # The current date
  <added|changed|removed|deprecated>:          # The type of change
    - type: <operation|parameter|model|enum>:  # What kind of thing changed
      id: <identifier>                         # The changed thing's identifier
      [note]: <note>                           # An optional, human-friendly note of what changedLegendoperationA versioned endpoint operationparameterAn input parameter for one or more endpoint operation(s)modelA response model for one or more endpoint operations(s)enumAn Enum that one or more input parameter(s) use to represent a list of choicesContributingDevelopment of ct-core-api happens at github:https://github.com/catalant/ct-core-apiPackage LayoutThe packages in this repository are carefully organized to avoid circular imports and to maintain the proper separation
of concerns.
It’s safe to import and use modules from packages as long as they don’t violate the ordering described below:ct_core_api.commonct_core_api.corect_core_api.api.libct_core_api.api.commonct_core_api.api.corect_core_api.api.appYour module can reference other modules in thesame packageorin packages at thesame level or higheraccording to this list. For example, a module inct_core_api.api.corecan depend on one fromct_core_api.api.commonbut not on one fromct_core_api.api.app.Smoke TestingHere’s how you can run the dummy application to verify the basic functioning of the core API and web application:Executable Python script:export PYTHONPATH=$PYTHONPATH:`pwd`
./ct_core_api/_main.pyFlask development server:export FLASK_APP=ct_core_api/_main.py
export FLASK_DEBUG=1
export FLASK_CONFIG=development
flask runContributorsjcrafford(Justin Crafford)LicenseLicensed under aMIT license.