High-level python framework that facilitates rapid server-side development with clean & pragmatic design!
Clone or download

readme.md

PROTON Logo

PROTON

The MIC stack genesis!

PROTON is a high-level Python framework that facilitates rapid server-side development with clean & pragmatic design. Thanks for checking it out!

PROTON aims at easing server-side development for all Python enthusiasts. Essentially, by running a shell command, developer will auto generate necessary Model, Controller and APIs! All of this with connectivity to Transactional Databases (PROTON supports Postgresql, MySQL & SQL Server),caching (Redis middleware), Auto generated OpenAPI specs & descriptive logging! One command, to get a production ready server-side stack!

Getting Started

  • Install postgres on your local machine. sudo apt-get install postgresql
  • Edit connection parameters for PROTON to achieve db connectivity @ databaseConfig.ini
  • Clone PROTON using git clone https://github.com/PruthviKumarBK/PROTON.git
  • Create a virtual environment. (If using anaconda, conda create -n <env name> python=3)
  • cd PROTON
  • pip install -r requirements.txt
  • PROTON relies on Redis for caching. Install redis using sudo apt-get install redis-server
  • That's it! You are ready to create your first MIC (Model, Interface, Controller) stack!

Example

Generate a new MIC stack named testMic : ./protongen.sh -n testMic -p 3000

PROTON MIC stack for testMic

Your code base will now include, dynamically generated content for testMic all the way from Model, Controller & Interface!

PROTON MIC stack for testMic

PROTON will dynamically generate an API for every method defined in the controller for testMic. Right now, there is a method named schemaInformation within controller_testMic.py for testMic. Convention for generated route will be <get_micName_controllerMethod>. Go to, localhost:3000/get_testMic_schemaInformation; you will see the schema information for connected database in postgresql! This is the default code auto-generated by PROTON for every new MicStack

PROTON MIC stack API

PROTON MIC stack API for testMic

For every auto generated route, cache will steer PROTON on steroids for subsequent get calls! Each entry in cache will live upto a day! You can change this lifespan by editing CACHE_LIFESPAN within PROTON's configuration.py

PROTON MIC stack API Cache

PROTON MIC stack Cache

Now, when you want to add a new method/expose newer APIs within testMic, all you should be doing is write SQL and create a method within PROTON's respective MIC stack.

PROTON MIC Adding Newer Methods

With newer method now in place, to generate API, all you do is issue this one command: ./protongen.sh -s yes

PROTON MIC NewMethod API

Newly generated route will also get cache settled!

PROTON MIC NewMethod at root

PROTON MIC Cache for NewMethod

PROTON MIC Cache for NewMethod

Generating a new MIC stack will leave existing stack unaltered.

PROTON MIC generating new stack

PROTON MIC NewMethod at root

Trace for PROTON stack will be enabled throughout. Checkout ./trace/ directory.

PROTON Trace

PROTON Trace Logs

PROTON also ships with ability to automagically generate OpenAPI specs!

PROTON OpenAPI

PROTON OpenAPI

Should you want to delete from existing PROTON MIC stack, you stand one command away! Like Generator, PROTON also ships with Destroyer which pragmatically clears the desired MIC from PROTON stack. (This will also clean the Cache entries automagically; only for mic that is targeted to be killed.)

./protonkill.sh -k <micName>

PROTON destroyer

PROTON will continue to perform/live with remaining MIC stack after destroyer completing its job!

PROTON After destruction of testMic

NOTE: PROTON uses Gunicorn as High Performance Server. Gunicorn is built to utilize kernel features of Unix/Linux machines. Hence, PROTON will be seamless on Unix/Linux platforms. On Windows, PROTON will require fallback to another WSGI server which is Work In Progress at this moment.

Features in active development:

  • Support for MySql, SqlLite and SqlServer relational databases.
  • Pipelines to transfer form and to datawarehouse to database. Support for GCP's bigQuery and AWS's RedShift in progress.
  • containerization of PROTON. Docker build and Kubernetes deployable PROTON!
  • Auto generated Swagger UI from PROTON generated openAPI specs.

Support

For any feedback or issues write to Pruthvi @ pruthvikumar.123@gmail.com. Ensure to have a valid subject line, detailed message with appropriate stack trace to expect prompt/quick response.

Tags

0.0.1 - PROTON confirms to PEP8 standards.

0.0.2 - Cache is unique not only per route but to query params per route.

License

BSD 3-Clause License

Copyright (c) 2018, Pruthvi Kumar All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.