bolt_compute 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bolt_compute-0.0.3/.github/workflows/release.yml +60 -0
- bolt_compute-0.0.3/.gitignore +10 -0
- bolt_compute-0.0.3/.vscode/launch.json +15 -0
- bolt_compute-0.0.3/PKG-INFO +100 -0
- bolt_compute-0.0.3/README.md +91 -0
- bolt_compute-0.0.3/bolt_compute.py +502 -0
- bolt_compute-0.0.3/examples/basic/beet.yaml +21 -0
- bolt_compute-0.0.3/examples/basic/data/example/function/basic.mcfunction +97 -0
- bolt_compute-0.0.3/pyproject.toml +26 -0
- bolt_compute-0.0.3/tests/snapshots/example__build_basic__0.data_pack/data/example/function/basic.mcfunction +50 -0
- bolt_compute-0.0.3/tests/snapshots/example__build_basic__0.data_pack/pack.mcmeta +13 -0
- bolt_compute-0.0.3/tests/snapshots/example__build_basic__1.resource_pack/pack.mcmeta +13 -0
- bolt_compute-0.0.3/tests/test_example.py +17 -0
- bolt_compute-0.0.3/uv.lock +631 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Make a release
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
inputs:
|
|
5
|
+
version_bump:
|
|
6
|
+
description: 'Overide the automatic version bump (default: automatic)'
|
|
7
|
+
required: true
|
|
8
|
+
default: 'minor'
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- patch
|
|
12
|
+
- minor
|
|
13
|
+
- major
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
release:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write
|
|
20
|
+
id-token: write
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v2
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
- name: Setup Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: '3.14'
|
|
30
|
+
- name: Install uv
|
|
31
|
+
uses: astral-sh/setup-uv@v4
|
|
32
|
+
with:
|
|
33
|
+
enable-cache: true
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: uv sync --group dev --all-extras
|
|
36
|
+
- name: Release
|
|
37
|
+
env:
|
|
38
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
VERSION_BUMP: ${{ github.event.inputs.version_bump }}
|
|
40
|
+
run: |
|
|
41
|
+
uv run pytest -vvv
|
|
42
|
+
git config --global user.name "github-actions"
|
|
43
|
+
git config --global user.email "action@github.com"
|
|
44
|
+
|
|
45
|
+
uv version --bump $VERSION_BUMP
|
|
46
|
+
uv build
|
|
47
|
+
|
|
48
|
+
git add pyproject.toml
|
|
49
|
+
git add uv.lock
|
|
50
|
+
git commit -m "$(uv version --short)"
|
|
51
|
+
git tag -a $(uv version --short) -m "$(uv version --short)"
|
|
52
|
+
git push origin $(uv version --short)
|
|
53
|
+
git push origin main
|
|
54
|
+
|
|
55
|
+
uv publish
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
"name": "Python Debugger: Module",
|
|
10
|
+
"type": "debugpy",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"module": "beet"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bolt_compute
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Requires-Python: >=3.14
|
|
6
|
+
Requires-Dist: beet>=0.116.0
|
|
7
|
+
Requires-Dist: bolt>=0.50.1
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Bolt Compute
|
|
11
|
+
|
|
12
|
+
A [beet](https://github.com/mcbeet/beet) plugin that allows to use expressions instead of inline [number providers](https://minecraft.wiki/w/Number_provider).
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
In a beet project, use `uv add bolt_compute` and add the module in the require phase in your beet config:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
require:
|
|
21
|
+
- bolt
|
|
22
|
+
- bolt_compute # <-- Add this line
|
|
23
|
+
pipeline:
|
|
24
|
+
- mecha
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
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:
|
|
30
|
+
|
|
31
|
+
```mcfunction
|
|
32
|
+
compute default {type:"minecraft:sum",operands:[1,1]}
|
|
33
|
+
data modify storage namespace:path path set compute default {type:"minecraft:sum",operands:[1,1]}
|
|
34
|
+
```
|
|
35
|
+
You can use:
|
|
36
|
+
|
|
37
|
+
```mcfunction
|
|
38
|
+
compute bolt (1 + 1)
|
|
39
|
+
data modify storage namespace:path path set compute bolt (1 + 1)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Literals values
|
|
43
|
+
|
|
44
|
+
Bolt compute supports the following literal values:
|
|
45
|
+
```mcfunction
|
|
46
|
+
compute bolt (storage namespace:path path) # compute default {type:"minecraft:storage",storage:"namespace:path",path:"path"}
|
|
47
|
+
|
|
48
|
+
x = 1 # bolt variable assignment
|
|
49
|
+
compute bolt (x + 1) # compute default {type:"minecraft:sum",operands:[1,1]}
|
|
50
|
+
|
|
51
|
+
y = "namespace:path_to_number_provider"
|
|
52
|
+
compute bolt (y * y) # compute default {type:"minecraft:product",operands:["namespace:path_to_number_provider","namespace:path_to_number_provider"]}
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Operators
|
|
57
|
+
|
|
58
|
+
`+`, `-`, `*`, are supported, as well as parentheses for grouping.
|
|
59
|
+
|
|
60
|
+
### Functions
|
|
61
|
+
|
|
62
|
+
Built-in functions are supported, such as :
|
|
63
|
+
- `average` expect a list using square brackets, e.g. `average([1,2,3])`
|
|
64
|
+
- `binomial` expect N and P, can be expressions, e.g. `binomial(10, 0.5)`
|
|
65
|
+
- `conditional` currently not implemented
|
|
66
|
+
- `maximum` expect a list using square brackets, e.g. `maximum([1,2,3])`
|
|
67
|
+
- `minimum` expect a list using square brackets, e.g. `minimum([1,2,3])`
|
|
68
|
+
- `uniform` expect two number providers, can be expressions, e.g. `uniform(1, 10)`
|
|
69
|
+
- `sum` expect a list using square brackets, e.g. `sum([1,2,3])`
|
|
70
|
+
- `product` expect a list using square brackets, e.g. `product([1,2,3])`
|
|
71
|
+
|
|
72
|
+
### Multiline expressions
|
|
73
|
+
|
|
74
|
+
Expressions can be multiline, for example:
|
|
75
|
+
|
|
76
|
+
```mcfunction
|
|
77
|
+
x = 1
|
|
78
|
+
y = 2
|
|
79
|
+
compute bolt (
|
|
80
|
+
x + y
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Full example
|
|
85
|
+
|
|
86
|
+
```mcfunction
|
|
87
|
+
|
|
88
|
+
x = "namespace:path_to_number_provider"
|
|
89
|
+
y = 256*256
|
|
90
|
+
|
|
91
|
+
data modify storage example:main result_bolt set compute bolt (
|
|
92
|
+
(storage example:main prod1)*(storage example:main prod2)*(storage example:main prod3)*2
|
|
93
|
+
*
|
|
94
|
+
2485*52+
|
|
95
|
+
maximum([0,1,(storage example:main prod2),1])+(143)-
|
|
96
|
+
(y*x) + x
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
More examples can be found in the [examples](examples) folder.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Bolt Compute
|
|
2
|
+
|
|
3
|
+
A [beet](https://github.com/mcbeet/beet) plugin that allows to use expressions instead of inline [number providers](https://minecraft.wiki/w/Number_provider).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
In a beet project, use `uv add bolt_compute` and add the module in the require phase in your beet config:
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
require:
|
|
12
|
+
- bolt
|
|
13
|
+
- bolt_compute # <-- Add this line
|
|
14
|
+
pipeline:
|
|
15
|
+
- mecha
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
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:
|
|
21
|
+
|
|
22
|
+
```mcfunction
|
|
23
|
+
compute default {type:"minecraft:sum",operands:[1,1]}
|
|
24
|
+
data modify storage namespace:path path set compute default {type:"minecraft:sum",operands:[1,1]}
|
|
25
|
+
```
|
|
26
|
+
You can use:
|
|
27
|
+
|
|
28
|
+
```mcfunction
|
|
29
|
+
compute bolt (1 + 1)
|
|
30
|
+
data modify storage namespace:path path set compute bolt (1 + 1)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Literals values
|
|
34
|
+
|
|
35
|
+
Bolt compute supports the following literal values:
|
|
36
|
+
```mcfunction
|
|
37
|
+
compute bolt (storage namespace:path path) # compute default {type:"minecraft:storage",storage:"namespace:path",path:"path"}
|
|
38
|
+
|
|
39
|
+
x = 1 # bolt variable assignment
|
|
40
|
+
compute bolt (x + 1) # compute default {type:"minecraft:sum",operands:[1,1]}
|
|
41
|
+
|
|
42
|
+
y = "namespace:path_to_number_provider"
|
|
43
|
+
compute bolt (y * y) # compute default {type:"minecraft:product",operands:["namespace:path_to_number_provider","namespace:path_to_number_provider"]}
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Operators
|
|
48
|
+
|
|
49
|
+
`+`, `-`, `*`, are supported, as well as parentheses for grouping.
|
|
50
|
+
|
|
51
|
+
### Functions
|
|
52
|
+
|
|
53
|
+
Built-in functions are supported, such as :
|
|
54
|
+
- `average` expect a list using square brackets, e.g. `average([1,2,3])`
|
|
55
|
+
- `binomial` expect N and P, can be expressions, e.g. `binomial(10, 0.5)`
|
|
56
|
+
- `conditional` currently not implemented
|
|
57
|
+
- `maximum` expect a list using square brackets, e.g. `maximum([1,2,3])`
|
|
58
|
+
- `minimum` expect a list using square brackets, e.g. `minimum([1,2,3])`
|
|
59
|
+
- `uniform` expect two number providers, can be expressions, e.g. `uniform(1, 10)`
|
|
60
|
+
- `sum` expect a list using square brackets, e.g. `sum([1,2,3])`
|
|
61
|
+
- `product` expect a list using square brackets, e.g. `product([1,2,3])`
|
|
62
|
+
|
|
63
|
+
### Multiline expressions
|
|
64
|
+
|
|
65
|
+
Expressions can be multiline, for example:
|
|
66
|
+
|
|
67
|
+
```mcfunction
|
|
68
|
+
x = 1
|
|
69
|
+
y = 2
|
|
70
|
+
compute bolt (
|
|
71
|
+
x + y
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Full example
|
|
76
|
+
|
|
77
|
+
```mcfunction
|
|
78
|
+
|
|
79
|
+
x = "namespace:path_to_number_provider"
|
|
80
|
+
y = 256*256
|
|
81
|
+
|
|
82
|
+
data modify storage example:main result_bolt set compute bolt (
|
|
83
|
+
(storage example:main prod1)*(storage example:main prod2)*(storage example:main prod3)*2
|
|
84
|
+
*
|
|
85
|
+
2485*52+
|
|
86
|
+
maximum([0,1,(storage example:main prod2),1])+(143)-
|
|
87
|
+
(y*x) + x
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
More examples can be found in the [examples](examples) folder.
|