Skip to main content

Plain-language logic engine

Project description

Plain-language logic engine — write rules in English, query from any language.

Think of it like SQL, but for rules instead of data. Instead of writing business logic as if/else code buried in your application, you write it in a .teleos file that reads like English. Any language — Python, Go, JavaScript, C++, C#, Java — can load that file and query it.

fact: alice is admin
fact: charlie is user
fact: charlie is banned
rule: if X is admin then X can access Y
rule: if X is user and not X is banned then X can access Y

ask:  alice can access document    → true
ask:  charlie can access document  → false
why:  charlie can access document  → Cannot prove: charlie can access document
                                      Nearest rule failed because: charlie is banned

Install

pip install teleos

Quick start

import teleos

engine = teleos.load("rules.teleos")

engine.ask("alice can access document")   # True
engine.why("alice can access document")   # proof string
engine.all("WHO can access report")       # ["alice", "bob"]
engine.add_fact("dave is admin")          # add at runtime

CLI

teleos run  rules.teleos   # run all ask:/why:/all: queries
teleos test rules.teleos   # run all assert: statements
teleos repl rules.teleos   # interactive session

.teleos syntax

# facts
fact: alice is admin
fact: alice has score 95

# rules — variables are ALL CAPS
rule: if X is admin then X can access Y
rule: if X has score S and S >= 90 then X gets distinction

# negation
rule: if X is user and not X is banned then X can post

# import another file
import: base-rules.teleos

# queries
ask: alice can access document     → true / false
why: alice can access document     → proof explanation
all: WHO gets distinction          → every matching value

# assertions (for teleos test)
assert: alice can access document
assert not: charlie can access document

Language bindings

Teleos includes a Rust core (teleos-core) that compiles to a shared library callable from any language via C FFI.

Bindings are available for Go, JavaScript/TypeScript, C++, C#, and Java. See https://github.com/teleos/teleos for details.

License

MIT

Project details


Download files

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

Source Distribution

py_teleos-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_teleos-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file py_teleos-0.1.0.tar.gz.

File metadata

  • Download URL: py_teleos-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for py_teleos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5cb1293ddad00d70b6de920c0ff962c75e33d2c10d07ded1b32a1d030fe021e4
MD5 ca075bd22fa3b0e56b4fdd5e723f22e2
BLAKE2b-256 26090ff31adbbad9467036b6b8b51b6f8d0018a639d79e0752869e84aa502bda

See more details on using hashes here.

File details

Details for the file py_teleos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_teleos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for py_teleos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c3c43e159c8b4d3829fb1b76c8728ef677f2d147b4751c1f82df760fef1b30c
MD5 019e6c6b86c6f4f6f4e3b48a84c1924a
BLAKE2b-256 234790758b5d85cbbc8287177816db1f4f0c7c60e29ac041a36453752a4676fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page