Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Simple expression language.

Project description


Documentation Status CircleCI PyPI

Ratus is a simple expression language that can be used to easily extend Python applications with an embedded expression language. Evaluating basic expressions is as simple as:

from ratus import Evaluator

evaluator = Evaluator()
evaluator.evaluate("1 + 1") # => 1
evaluator.evaluate("1 > 1") # => False
evaluator.evaluate("if(1 < 2, 10, 5)") #  => 5

For more information, please check out the docs

What's in a name?

When I first started this project I did a bit of research around parsing techniques as this is really the most complex part. One idea that that really stuck out to me was packrat parsing. This technique allows for linear time parsing, as opposed to the usual exponential time of backtracking parsing.

Currently packrat parsing isn't implemented for ratus but I'm working on it!



  • <input type="checkbox" disabled="" /> Fully document all features
    • <input type="checkbox" disabled="" /> API
    • <input type="checkbox" disabled="" /> Grammar
  • <input type="checkbox" disabled="" /> Fix known bugs
    • <input type="checkbox" disabled="" /> Don't require functions to be the root of an expression
      • e.g. pow(2, 2) + 1 should be allowed

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ratus, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size ratus-0.0.3-py3-none-any.whl (8.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ratus-0.0.3.tar.gz (7.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page