Skip to main content

Run blockly workspaces directly, without the need to convert it to Python code.

Project description

tests

GitHub Actions Build Status

Run blockly workspaces directly, without the need to convert it to Python code.

  • Free software: MIT license

Installation

Currently, you must install the in-development version with (we are not on pypi yet):

pip install https://github.com/bankstore-fr/python-blockly-runner/archive/main.zip

Documentation

To use the project:

from blockly_runner import execute_workspace_merge_all_roots, execute_workspace

# Result will contain all the variable updated to match their new value.
# If you have many block roots, you will get a global result.
result = execute_workspace_merge_all_roots(my_dict_workspace, {"var1": 1, "var2": "Hi"})

# If you have many block roots, you will get a list of result with as many element as you have roots.
results = execute_workspace(my_dict_workspace, {"var1": 1, "var2": "Hi"})

We currently support:

  • Logic with if, if/else, if/else if, negation, comparison operators, logic operations.

  • Basic math: create a number variable, basic math operations (+, -, *, /, ^).

  • Basic text: create a text variable.

  • Variable management: set a variable, access a variable, change a number variable by a delta.

The following exceptions can be raised:

  • UndefinedVariable if you try to access a variable before it is defined.

  • InvalidBlock if we encounter an invalid block. It shouldn’t happen if you pay attention in the interface ;-) And it’s there it’s easier to spot where this error comes from.

Contributions are welcomed to help us go further.

Development

To run all the tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

Create a new release

You need flit to publish the release.

  1. Bump version in src/blockly_runner/__init__.py.

  2. Update the CHANGELOG.rst.

  3. Commit and push.

  4. Publish the package with flit publish.

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

blockly_runner-0.1.3.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

blockly_runner-0.1.3-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file blockly_runner-0.1.3.tar.gz.

File metadata

  • Download URL: blockly_runner-0.1.3.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.0

File hashes

Hashes for blockly_runner-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e549ccc31172ac6921cb185e1211f4638a53cbc4ad54fc1dfafb10805e1cc571
MD5 1ae3a09a2f1b3e24486118fbf5c53636
BLAKE2b-256 f6bb73bc0732a3116ca5ca8ab85b8011543b998aa63c1d2fd24f745b40915241

See more details on using hashes here.

File details

Details for the file blockly_runner-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for blockly_runner-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b35fd62418374498dac1e563a2c9becfa3677460e10c5f676391048a27f619e7
MD5 daa30315eadb2fd2b3ebfab0df26ae34
BLAKE2b-256 2876599f7614643850af71b54da0b8dca5a27b6c1264b16521c0ca0ea5f7f798

See more details on using hashes here.

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