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

Boolexp provides “safe” evaluation of boolean expressions for use cases where eval might be dangerous. Boolexp expressions are context-free and mimic Python sytax. Only basic math opearations and data structures are provided.


To install Boolexp, change to the directory where is located and type:

python install


  • Python 2.7
  • pyparsing 1.5.0 or later

Expression Syntax Overview

Basic math operators *,/,+,- have highest priority

>>> from boolexp import Expression
>>> Expression("4 + 4 / 2").evaluate()
>>> 6
>>> Expression("( 4 + 4 ) / 2 ").evaluate()
>>> 4

Comparsion operators !=, ==, <, >, <=, >=, in are next in priority. All comparsion operators have return type of boolean, which can be used as input for boolean operators and, or, not with lowest priority.

>>> from boolexp import Expression
>>> Expression(2 == 1).evaluate()
>>> False
>>> Expression("2 * - 2 == - 4").evaluate()
>>> True
>>> Expression("not 2 == 3").evaluate()
>>> True
>>> Expression("3 <= 8 and 2 == 5").evaluate()
>>> False

Expresions with with variables

This all would not be much of a fun without posibility to use variables. Allowed types for variables are bool,int,float,str,list,dict

>>> from boolexp import Expression
>>> Expression("1 in v").evaluate(dict(v=[1,2])).evaluate()
>>> True
>>> Expression("one[1].part == 2").evaluate(dict(one=[1, dict(part=2)], two=1)).evaluate()
>>> True


This project is now in a state of proof of concept only, thus far from suitable for production enviroment.

Release History

Release History


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

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
boolexp-0.1.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source Sep 24, 2013

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