Main » Our experience » Current technology stack » Programming Languages » Python

Python

Why python


There are few strong reasons why we use Python as our main development language. Those includes, but not limited to:

  • Python code is very readable
  • The evolution of language is well structured and steadly goes on
  • There are a lot of ready modules & solutions

Python Frameworks


A Web Framwork (see: python wiki) is a collection of packages or modules which allow developers to write Web applications or services without having to handle such low-level details as protocols, sockets or process/thread management.

Django


We are using Django (http://djangoproject.com) since 2006. We have used it originally to rewrite one big e-commerce site from Zope to Django, and later expanded this framework usage to all our projects. The core useful aspects of Django framework are:

  • ORM allows easy access to the SQL data, it encapuslates a lot of low-level details, like
  • escaping queries, or relating tables. It also allows us to embed business logic to data records.
  • Half-automated forms interface keep good balance between easiness of constructing forms
  • and the abilities to extend them.
  • Automated /admin/ site makes it easy to implement typical CRUD operations.
  • Due to popularity of this framework, there are much more developers available on
  • Python/Django stack.
  • Framework itself allows us to maintain our own set of modules which we re-use from project
  • to project. So far we have created reusable modules for:
    • Data output: table-like data grids
      • softadmin - quick data table output and end-user controlled configuration of results. User profiles,
      • custom filters, sorting, output to CSV, action on multiple items or whole data set.
      • tableview - data output, configurable mostly by developer. Used for restricted views for
      • management interfaces
      • ua2.django-tables (https://bitbucket.org/ua2web/ua2.django-tables) - our port of django-tables2
      • with support for additional data sources
    • ua2.MongoLog - logging to MongoDB (uses mongoengine)
    • ua2.ajax - a set of Django related utitities and decorators for making AJAX queries
    • Celery
    • MD5Storage - replacement for standard Django storage for files. Allows to extend limits
    • on number of uploaded files related to field model. Eliminates duplicates.
    • simplecms - a set of utilies to easy content management. For example, extend FlatPages to
    • have related files and images.
    • AttributeEngine - pluggable categorizable attributes for any object. Makes it easy to extend your model
    • on user controlled level.
    • ua2.forms - our additions to django standard form management. More customization on template/form/field
    • rendering, default RequestContext injection, and some more.
    • A collection of Django tricks and utilties, here are some of highlights:
      • profiling.py - use "hotshot" profiler and "gprof" to profile any Django view. Ref1, Ref2.
      • testutils.py - a port of Django test case with some additional functions to test on real data.
      • cache.py - custom cashe invalidation utilties
      • ajax_auth.py - ajax authorization check
      • crossgrid.py - draw cross grid data arrays
      • dbutils.py - helper ORM utilities, utilities to drop/recreate database, execute custom SQL commands,
      • record locking.
      • paginator.py - replacement for Django paginator
      • ... and some more into into DjHDGutils ...

Twisted

Twisted - is an event-driven networking engine written in Python. We use Twisted to implement:

  • Custom protocols support
  • Asterisk (call centers)

Due to its asynhronous nature Twisted cab processes a lot of simultaneous connections, which makes it ideal for use on higly loaded systems where fast round trip time is required.