blockly_runner 0.1.4

Creator: codyrutscher

Last updated:

Add to Cart

Description:

blockly runner 0.1.4

tests





pypi







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 blockly-runner


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.

Bump version in src/blockly_runner/__init__.py.
Update the CHANGELOG.rst.
Commit and push.
Publish the package with flit publish.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.