Skip to main content

bolt-expressions

GitHub Actions PyPI PyPI - Python Version Code style: black Discord

a pandas-esque API for creating expressions within bolt

Introduction

Bolt is a scripting language which mixes both python and mcfunction. This package amplifies this language by adding an API for creating fluent expressions loosely based off of the pandas syntax. These expressions are use for simplifying large bits of scoreboard and storage operation allowing you to swiftly create complex operations with the ease of normal programming.

from bolt_expressions import Scoreboard, Data

math = Scoreboard.objective("math")
storage = Data.storage(example:temp)

stack = storage.hotbar[0]

math["@s"] = stack.Count * math["$cost"] + math["$value"] - stack.tag.discount * 0.75

->

execute store result score @s math run data get storage example:temp hotbar[0].Count 1
scoreboard players operation @s math *= $cost math
scoreboard players operation @s math += $value math
execute store result score $i1 bolt.expr.temp run data get storage example:temp hotbar[0].tag.discount 0.75
scoreboard players operation @s math -= $i1 bolt.expr.temp

Installation

The package can be installed with pip. Note, you must have beet, mecha and bolt installed to use this package.

$ pip install bolt-expressions

Getting started

This package is designed to be used within any bolt script (either a .mcfunction or bolt file) inside a bolt enabled project.

require:
    - bolt
    - bolt_expressions

pipeline:
    - mecha

Once you've required bolt and bolt_expressions, you are able to import the python package directly inside your bolt script.

from bolt_expressions import Scoreboard, Data

Now you're free to use the API objects. Create objectives, block, storage and entity nbt sources to easily write expressions as simple or complex as you like to make it.

math = Scoreboard.objective("math")
executor = Data.entity("@s")
block = Data.block("~ ~ ~")
storage = Data.storage(example:storage)

math["$value"] = math["$points"] + executor.Health*10 + block.Items[0].Count - storage.discount

storage.values.append(math["$value"])

->

execute store result score $value math run data get entity @s Health 10
scoreboard players operation $value math += $points math
execute store result score $i1 bolt.expr.temp run data get block ~ ~ ~ Items[0].Count 1
scoreboard players operation $value math += $i1 bolt.expr.temp
execute store result score $i2 bolt.expr.temp run data get storage example:storage discount 1
scoreboard players operation $value math -= $i2 bolt.expr.temp
data modify storage example:storage values append value 0
execute store result storage example:storage values[-1] int 1 run scoreboard players get $value math

Features

  • Robust API supporting Scoreboards, Storage, Blocks, and Entities
  • Provides an interface to manipulate large, complex mathematical expressions simplily
  • Automatically initializes objectives and score constants
  • Allows you to interopt custom variables with normal commands

Checkout some examples over at our docs!

Contributing

Contributions are welcome. Make sure to first open an issue discussing the problem or the new feature before creating a pull request. The project uses poetry.

$ poetry install

You can run the tests with poetry run pytest.

$ poetry run pytest

The project must type-check with pyright. If you're using VSCode the pylance extension should report diagnostics automatically. You can also install the type-checker locally with npm install and run it from the command-line.

$ npm run watch
$ npm run check

The code follows the black code style. Import statements are sorted with isort.

$ poetry run isort bolt_expressions examples tests
$ poetry run black bolt_expressions examples tests
$ poetry run black --check bolt_expressions examples tests

License - MIT

Metadata

Release files for bolt-expressions 0.19.2

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

Source distribution (sdist)

Source distribution for bolt-expressions 0.19.2
File Size Uploaded
bolt_expressions-0.19.2.tar.gz 39.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bolt-expressions 0.19.2
File Interpreter ABI Platform
bolt_expressions-0.19.2-py3-none-any.whl Python 3 none any Details

Total release size: 85.8 kB

Release files / bolt_expressions-0.19.2.tar.gz

Download URL bolt_expressions-0.19.2.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e3ef28af5b13aa7a88c240e6b72f1cc7e736790b466f2d856977e25f9fa237
BLAKE2b-256 checksum
How to use checksums
6e2a8c2aed527acbdebacc2b23a36aa6c26a103dc6645b5320f9bc864131eeeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.

Transparency log

Release files / bolt_expressions-0.19.2-py3-none-any.whl

Download URL bolt_expressions-0.19.2-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e303efe505e2d7678e179ae5d663bc00fa7fc6a04bf57f3ed5dd3676b34d6996
BLAKE2b-256 checksum
How to use checksums
c25c65a87588d2a1f26065d4077447fdd1c929aa3b185bcbbb5f6628fbbea7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.19.2 This release

2 release files

0.19.1

2 release files

0.18.0

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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