Skip to main content

EveScript is a simple script language for event-based automation tasks.

from evescript.compiler import EveScriptCompiler
from evescript.executor import EveScriptExecutor

script = '''
if ($lightSensor > 20) {
  say("It's daytime now!")
}
'''

def lightSensor():
    return read_light_sensor_port()

compiler = EveScriptCompiler()
compiled_script = compiler.compile(script)

executor = EveScriptExecutor({
    'actions': { 'say': lambda x: print(x) },
    'variables': { '$lightSensor': lightSensor },
})

executor.run_script(compiled_script)
# Out: It's daytime now!

EveScript allows you to write simple event-based scripts that evaluate various conditions and execute actions. The conditions and actions are highly customizable to maximize the flexibility. EveScript can be used in embedded systems (such as Raspberry Pi) to implement a flexible event-based system.

Installation

pip install evescript

Changelog

0.5.0 (2021-03-29)

  • Support if…else statement.

  • Support executing actions outside if statement.

  • Support nested if statement.

  • Support actions with no params.

0.4.0 (2021-03-27)

  • Added support for using true/false as conditions.

0.3.0 (2021-03-20)

  • Fixed typo (EveScriptExector => EveScriptExecutor)

0.2.1 (2021-03-20)

  • Added decompiler.

  • Compiler will not rename built-in operators.

0.1.1 (2021-03-19)

  • First release on PyPI.

Release files for evescript 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evescript 0.5.0
File Size Uploaded
evescript-0.5.0.tar.gz 63.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evescript 0.5.0
File Interpreter ABI Platform
evescript-0.5.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 84.7 kB

Release files / evescript-0.5.0.tar.gz

Download URL evescript-0.5.0.tar.gz
Size 63.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c6113a901e72d5c3e9e340a20fe54bf568b71f4021e9adc2d44605e968faf166
BLAKE2b-256 checksum
How to use checksums
520751f1fd7a3ab62e30add8a207d7a5a1400cef6695960239674610afb5ef3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / evescript-0.5.0-py2.py3-none-any.whl

Download URL evescript-0.5.0-py2.py3-none-any.whl
Size 21.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
43b1b7f27afdc6f0c81ea872ad6e88e45a1cbcc2734c45e2813cd8935fc92da0
BLAKE2b-256 checksum
How to use checksums
439d1ae86b16b22200c4b8553ea43f589bf726de4f5a0b131b948e00c02bef6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page