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
Condiment
=========

Conditionally include or remove code portion, according to the environment. It
support offline and on-thy-fly preprocessing.

Conditional features
--------------------

Let's say you want to release a version of your code with or without a feature,
like unlimited life in a game. It can be useful during development, but you
don't want the code to be available in production.

Condiment recognize the environment variables that starts with the prefix
"WITH_" all uppercase. We could name our feature: `WITH_GODMODE`.
In python, you need to include condiment, and install it. You can put it in
exclude block, in order to be removed during the offline preprocessing.

```python
#exclude
import condiment; condiment.install()
#endexclude

class Player:

def die(self):
if not WITH_GODMODE:
self.life -= 1
return self.life
```

You can run it without the godmode:

```
$ python main.py
```

Or by activating the godmode at runtime:

```
$ WITH_GODMODE=1 python main.py
```

You can generate the final version for production too:

```
$ WITH_GODMODE=1 condiment main.py > prod_main.py
$ cat prod_main.py

class Player:

def die(self):
self.life -= 1
return self.life
```

Replacing variables
-------------------

If you want to set an initial value, all the token founds in the environment
will be replaced during the generation. For example, a `WITH_LIFE` token could
have the initial number of life.

```python
#exclude
import condiment; condiment.install()
#endexclude

class Player:

def __init__(self):
Player.__init__(self)
self.life = 10
if WITH_LIFE:
self.life = WITH_LIFE

def die(self):
if not WITH_GODMODE:
self.life -= 1
return self.life
```


Why using condiment ?
---------------------

Compared to others existing preprocessor:

- condiment doesn't rewrite the module on import, it will just inject the
detected variables in the globals() of the module. This is avoiding double
import of your module.
- condiment use python expression for condition (only on if)
- condiment doesn't need you to declare the variable prior the usage of them.
Using environment variables allow you to declare them before launching the
app, and change the behavior of your app easilly.
- condiment will replace all the variables in offline version.

Related projects
----------------

- pypreprocessor
- preprocess
Release History

Release History

0.6

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.5.2

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.5.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

0.5

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.4

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.3

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

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
condiment-0.6.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source May 22, 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