This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This is an A/B testing extension for Jinja. It allows you to encode experiments in your templates and renders the experiment selected by the AB_EXPERIMENT environment variable. ‘control’ is the default experiment name if AB_EXPERIMENT is not specified!

To install:

pip install jinja-ab

Enable the extension in your code like this:

import os
import jinja_ab

env = Environment(
        loader=FilesystemLoader(),
        extensions=[jinja_ab.JinjaAbExperimentExtension],
    )

os.environ['AB_EXPERIMENT'] = 'v1'
template = env.get_template('index.html')
return template.render(context)

The template syntax is:

{% experiment control %}This is the control{% endexperiment %}
{% experiment v1 %}This is version 1{% endexperiment %}

Alternative syntax is also supported:

{% ab control %}This is the control{% endab %}
{% ab v1 %}This is version 1{% endab %}

You can also mix the two tags in a single template:

{% experiment control %}This is the control{% endexperiment %}
{% ab v1 %}This is version 1{% endab %}

Single and double quoted names are also supported!

NOTE: this extension deals with rendering the template string based on the value of AB_EXPERIMENT. It is up to you or your Jinja2 based tools to decide what to do with the result. At Mr. Senko we use this extension as part of the pelican-ab plugin.

Contributing

Source code and issue tracker are at https://github.com/MrSenko/jinja-ab

Commercial support

Mr. Senko provides commercial support for open source libraries, should you need it!

Release History

Release History

0.3.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
jinja-ab-0.3.0.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source May 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting