Skip to main content

Bolt Compute

A beet plugin that allows to use expressions instead of inline number providers.

Installation

In a beet project, use uv add bolt_compute and add the module in the require phase in your beet config:

require:
  - bolt
  - bolt_compute # <-- Add this line
pipeline:
  - mecha

Usage

Any place where the compute command/subcommand is used, you can use the bolt subcommand to use an expression instead of a number provider. For example, instead of:

compute default {type:"minecraft:sum",operands:[1,1]}
data modify storage namespace:path path set compute default {type:"minecraft:sum",operands:[1,1]}

You can use:

compute bolt (1 + 1)
data modify storage namespace:path path set compute bolt (1 + 1)

Literals values

Bolt compute supports the following literal values:

compute bolt (storage namespace:path path) # compute default {type:"minecraft:storage",storage:"namespace:path",path:"path"}

x = 1 # bolt variable assignment
compute bolt (x + 1) # compute default {type:"minecraft:sum",operands:[1,1]}

y = "namespace:path_to_number_provider"
compute bolt (y * y) # compute default {type:"minecraft:product",operands:["namespace:path_to_number_provider","namespace:path_to_number_provider"]}

Operators

+, -, *, are supported, as well as parentheses for grouping.

Functions

Built-in functions are supported, such as :

  • average expect a list using square brackets, e.g. average([1,2,3])
  • binomial expect N and P, can be expressions, e.g. binomial(10, 0.5)
  • conditional expect a condition (as a inline predicate), on_true and on_false values as expressions, e.g. conditional({}, 1, 0)
  • maximum expect a list using square brackets, e.g. maximum([1,2,3])
  • minimum expect a list using square brackets, e.g. minimum([1,2,3])
  • uniform expect two number providers, can be expressions, e.g. uniform(1, 10)
  • sum expect a list using square brackets, e.g. sum([1,2,3])
  • product expect a list using square brackets, e.g. product([1,2,3])

If-else expressions

If-else expressions are supported, and equivalent to the conditional function, for example:

compute bolt (
    220210 if {} else 23
#    ^        ^       ^
#    |        |       |
#  on_true    |       on_false
#             |
#   predicate condition
)

Multiline expressions

Expressions can be multiline, for example:

x = 1
y = 2
compute bolt (
    x + y
)

Full example

x = "namespace:path_to_number_provider"
y = 256*256

data modify storage example:main result_bolt set compute bolt (
    (storage example:main prod1)*(storage example:main prod2)*(storage example:main prod3)*2
    *
    2485*52+
    maximum([0,1,(storage example:main prod2),1])+(143)-
    (y*x) + x
)

More examples can be found in the examples folder.

Metadata

Release files for bolt_compute 0.1.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 bolt_compute 0.1.0
File Size Uploaded
bolt_compute-0.1.0.tar.gz 75.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bolt_compute 0.1.0
File Interpreter ABI Platform
bolt_compute-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.5 kB

Release files / bolt_compute-0.1.0.tar.gz

Download URL bolt_compute-0.1.0.tar.gz
Size 75.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a1804f0e941fd56197666d0640043e2d2e0ff31f760711c5e93f83f0636f8f2e
BLAKE2b-256 checksum
How to use checksums
587f12d3538569f44a72b059642f3fc2e98eda5ec25ac8c202a364c01f7d28ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bolt_compute-0.1.0-py3-none-any.whl

Download URL bolt_compute-0.1.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd9b24c5a9f2ed02e8ff1ebf5a0453b3f584c06948837b131b4dbd24ad118dcb
BLAKE2b-256 checksum
How to use checksums
711d6967aa9418326089b195ab6887c3247a246b1eeac39f31483a3f10749991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.3

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