Skip to main content

zsl application framework for web based services

Project description

Build Status Coverage Status

ZSL - z' service layer

ZSL is a Python micro-framework utilizing dependency injection for creating service applications on top of Flask web framework and Gearman job server or Celery task queue.


We developed ZSL to modernize our workflow with maintaining our clients' mostly web applications written in various older CMS solutions without the need to rewrite them significantly. With ZSL we can write our new components in Python, with one coherent shared codebase, accessible trough Gearman or JavaScript. Also the same code can be called through various endpoints - web or task queue nowadays.


At current stage this should be taken as proof of concept. We don't recommend to run in any production except ours. It is too rigid, with minimum test coverage and lots of bad code practices. We open sourced it as way of motivation for us to make it better.


We recommend to install it trough PyPi and run it in a virtualenv or docker container.

$ pip install zsl

Getting started

For now it is a bit cumbersome to get it running. It has inherited settings trough ENV variables from Flask and has a rigid directory structure like django apps. On top of that, it needs a database and Redis.

The minimum application layout has to contain:

├── app                    # application sources
│   ├──
│   └── tasks              # public tasks
│       ├──
│       └──
├── settings               # settings
│   ├── app_settings.cfg
│   ├──
│   └──
└── tests
$ export ZSL_SETTINGS=`pwd`/settings/app_settings.cfg
# settings/app_settings.cfg

TASKS = TaskConfiguration()\
DATABASE_URI = 'postgresql://postgres:postgres@localhost/postgres'
    'host': 'localhost',
    'port': 6379,
    'db': 0

class HelloWorldTask:
    def perform(self, data):
        return "Hello World"
$ python -m zsl web
* Running on (Press CTRL+C to quit)
$ curl http://localhost:5000/task/hello/hello_world_task
Hello world!


Deploy will happen upon pushing a new tag to Gitlab.

Creating new tag/version

Use bump2version to update version in config files. It will also create commit and new tag.

$ bumpversion --new-version ${VERSION} {major|minor|patch} --tag-name ${VERSION}

Version name uses semver. Starts with number.


Current pipeline tries to copy previous Travis runs. It runs tox target seperately and on a tag push will create deploy.

Tox Docker image

Gitlab pipeline runs inside a docker image which is defined in docker/Dockerfile.tox. Currently we manually configure, build and push it to gitlab container registry. So to update the container follow this steps.

When pushing for the first time run, you have to create an access token and login to atteq gitlab container registry. Go to and create a token to read/write to registry. Then run

docker login

To build/push the image:

  1. Build image locally.

    docker build -t zsl/tox-env -f docker/Dockerfile.tox

  2. Tag image.

    docker tag zsl/tox-env

  3. Push image.

    docker push

  4. Update image hash in .gitlab-ci.yml. (copy from build output or docker images --digests).

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

zsl-1.0.0.tar.gz (119.2 kB view hashes)

Uploaded source

Built Distribution

zsl-1.0.0-py2.py3-none-any.whl (124.4 kB view hashes)

Uploaded py2 py3

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