wiki:Notes/PythonFramework

Python Frameworks

Why am I not more excited by large Python ( "full stack" ) frameworks ? Why do I prefer micro frameworks ?

After all, "full stacks" are not so huge really, not compared to other environments ( Java, for instance ). Maybe they don't do 'enough more' to warrant steep learning curves and increased resource consumption ... who knows. They just don't thrill me, not the way the little ones do.

Maybe it's in the inherent nature of the PyWacket project, that is lots of little pieces of integration functionality running under different OSs on different machines.

In any case, this wiki aspires to some level of completeness, so I need to acknowledge their existence if nothing else.

Maybe I'll find a killer app that works out-of-the-box ( DjangoCMS ? ) and that will ease me into it ...

You're still going to need your own server to run them. No CGI on these babies.

Full Stack

https://wiki.python.org/moin/WebFrameworks

Generally, frameworks provide support for a number of activities such as interpreting requests (getting form parameters, handling cookies and sessions), producing responses (presenting data as HTML or in other formats), storing data persistently, and so on.

Since a non-trivial Web application will require a number of different kinds of abstractions, often stacked upon each other, those frameworks which attempt to provide a complete solution for applications are often known as full-stack frameworks in that they attempt to supply components for each layer in the stack.

Many frameworks now provide an element of customization in their support for the above activities and abstractions, utilizing components in that they provide abstractions only for certain specific things. As a result, it can be possible for you to build your own full-stack framework almost entirely from existing components.

Django

Very good and very big ... very big, 42 MB total, a lot is documentation and languages, about 30 MB is "contributions" such as admin ( 3MB ). Even after factoring out extra and plugins, the core still weighs in at a solid 6 MB of code. That's a lot of Python.

https://www.djangoproject.com/

https://medium.com/cs-math/11-things-i-wish-i-knew-about-django-development-before-i-started-my-company-f29f6080c131

Django CMS

https://www.django-cms.org/en/

http://docs.django-cms.org/en/support-3.0.x/

Web2Py

http://www.web2py.com/

Free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications.

Requires Python 2.7

http://www.web2py.com/examples/default/download

The source code version works on all supported platforms, including Linux, but it requires Python 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems, including Linux and BSD.

Has Windows .zip installer.

After download, unzip it and click on web2py.exe (windows) or web2py.app (osx). To run from source, type: python2.7 web2py.py

http://web2py.com/poweredby

http://www.web2py.com/appliances

w2p files are web2py packaged applications. Can cut and paste the "download" link directly into web2py admin interface to install them.

http://www.web2py.com/examples/default/documentation

http://web2py.com/book

http://web2py.com/books/default/chapter/29/04/the-core

API Documentation - http://web2py.readthedocs.org/en/latest/

http://en.wikipedia.org/wiki/Web2py

The design of web2py was inspired by the Ruby on Rails and Django frameworks. Like these frameworks, web2py focuses on rapid development, favors convention over configuration approach and follows a model–view–controller (MVC) architectural pattern.

Parallel with Java#PlayFramework -> ".. It aims to optimize developer productivity by using convention over configuration ..." See DesignPatterns#ConventionOverConfiguration.

Snippets, recipes and tricks - http://www.web2pyslices.com/home

Turbo Gears

http://www.turbogears.org/

Zope2

https://pypi.python.org/pypi/Zope2

http://zope2.zope.org/

Zope is a legacy framework, which is kept alive to support existing applications built on top of it. It is no longer recommended to start new projects based on it, unless you are intimately familiar with the technology stack.

http://en.wikipedia.org/wiki/Zope

Zope Component Architecture - http://muthukadan.net/docs/zca.html - an oldie but a goodie.

Zope Component Architecture (ZCA) is a Python framework for supporting component based design and programming. It is very well suited to developing large Python software systems ...

There are three core packages related to the ZCA:

zope.interface is used to define the interface of a component.

zope.event provides a simple event system.

zope.component deals with creation, registration and retrieval of components.

https://zopetoolkit.readthedocs.io/en/latest/

If you want to use the Zope Toolkit Known-Good-Set (KGS), you should copy the ztk-versions.cfg file

https://github.com/zopefoundation/zopetoolkit/blob/master/ztk-versions.cfg

https://docs.zope.org/zope.interface/

https://docs.zope.org/zope.event/

https://docs.zope.org/zope.component/

Also see: http://en.wikipedia.org/wiki/Plone_%28software%29

Plone is a free and open source content management system built on top of the Zope application server. Plone is positioned as an "Enterprise CMS" and is most commonly used for intranets and as part of the web presence of large organizations.

https://plone.org/

Pylons

http://www.pylonsproject.org/

Rather than focusing on a single web framework, the Pylons Project will develop a collection of related technologies. The first package is the Pyramid web framework.

http://docs.pylonsproject.org/en/latest/

http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-documentation

http://en.wikipedia.org/wiki/Pylons_project

Spring Python

Based on the book Spring Python 1.1. Interesting both as a 'pattern' and as an 'anti-pattern' in different ways, which is an achievement in itself ...

https://github.com/springpython/springpython

"RC" release June 2013, but last real commits were Dec. 2011. Download is 29.4 MB.

http://springpython.webfactional.com/

Spring Python is an offshoot of the Java-based Spring Framework and Spring Security, targeted for Python. Spring provides many useful features, and I wanted those same features available when working with Python. -- Greg Turnquist, project lead

Last site update 2009 ...

SeeJavaSpring

http://docs.spring.io/spring-python/1.2.x/sphinx/html/

http://docs.spring.io/spring-python/1.2.x/sphinx/html/overview.html

Spring Python intends to take the concepts that were developed, tested, and proven with the Spring Framework, and carry them over to the language of Python ...

The following features have been implemented:

Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use PythonConfig, YamlConfig or XMLConfig to plugin your object definition to an ApplicationContext.

Aspect Oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing.

Database Template - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest.

Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated.

Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization.

Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change.

JMS Messaging - Connect to Java or Python applications using queueing middleware. Spring Python can act as a standalone client of a JMS provider with no Java EE infrastructure needed on Python side.

Plug-ins/command-line tool - Use the plugin system designed to help you rapidly develop applications.

Uses Pyro in the mix ...

Interesting article about writing a book ( this is the 'anti-pattern' part ) - http://blog.greglturnquist.com/category/spring-python

So by now, if I haven’t smashed your dream of writing a technical book too badly, I wish you only the best in going out, submitting a proposal, and snagging a contract.

See Developing Concrete Usage Scenarios at semantastic.com

StackStorm

Big and fairly complete. Has Rules -> Actions for workflow automation.

https://docs.stackstorm.com/index.html

https://docs.stackstorm.com/overview.html

StackStorm is a platform for integration and automation across services and tools. It ties together your existing infrastructure and application environment so you can more easily automate that environment. It has a particular focus on taking actions in response to events.

https://docs.stackstorm.com/rules.html

StackStorm uses rules and worfklows to capture operational patterns as automations. Rules map triggers to actions (or workflows), apply matching criteria and map trigger payload to action inputs.

https://github.com/StackStorm

https://github.com/StackStorm/st2

StackStorm (aka "IFTTT for Ops") is event-driven automation commonly used for auto-remediation, security responses, facilitated troubleshooting, complex deployments, and more. Includes rules engine, workflow,1800+ integrations (see /st2contrib), native ChatOps and so forth.

https://github.com/StackStorm/st2contrib

StackStorm integration packs for many common tools and services. It also contains helpful tools to build integrations and automations with StackStorm.

https://docs.stackstorm.com/install/index.html

... How do you just get started? Get yourself a clean 64-bit Linux box that fits the system requirements.

Whoops, no Windows ! Still worth a look for the [non-chaining] rule engine, etc.

Also See

https://wiki.python.org/moin/WebComponents

For use with some of the frameworks listed on WebFrameworks, the components/libraries/toolkits on this page often attempt to solve common problems in a way that can work with more than one particular framework ...

http://en.wikipedia.org/wiki/Category:Python_web_application_frameworks

Last modified 6 weeks ago Last modified on 03/17/2017 06:45:47 PM