Skip to main content

Logics is a user-friendly formula language with a subset of Python''s expression syntax

Project description

A hexagonal logo of Logics

Logics

Badge showing current PyPI version if logics-py Badge showing current npm version if logics-js Badge displaying the license
A tiny, sandboxed, secure and extendable formula language with a flavor of Python.

About

Logics is a simple expression language with the goal to provide equal syntax and semantics for different runtime contexts and host languages.

  • logics-js is a pure JavaScript implementation of Logics provided as npm-package.
  • logics-py is a pure Python implementation of Logics provided as PyPI-package.

Both packages are under recent development and not stable right now. They are maintained in separate version numbers.

Features

  • Secure, native, running in a sandboxed environment apart from the host language
    • Disallows variable assignment, except in comprehensions
    • logics-js: Implementation in JavaScript
    • logics-py: Implementation in Python
  • Python-inspired syntax and semantics
    • Make use of all standard operators
      • Unary +, -, ~, not
      • Binary +, *, -, /, //, **
      • Comparison ==, !=, <>, <, <=, >, >=, in, not in
      • Logical and, or
      • Conditions y if x else z
      • Comprehensions [x for x in y if z]
    • Slices x[:]
    • Attribute access x[y]
    • # comments in separate lines
    • Dedicated Value object abstraction of native types for
      • True, False, None
      • int, float, str
      • list for arrays
      • dict for structured objects
  • Provides a set of functions that can be used in expressions
  • Extendable to custom functions

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

logics_py-0.0.9-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

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