Skip to content

Commit

Permalink
feat: update beet and mecha
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Jul 22, 2024
1 parent 8c6e66d commit d55c37d
Show file tree
Hide file tree
Showing 56 changed files with 172 additions and 90 deletions.
14 changes: 11 additions & 3 deletions bolt/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@
cast,
)

from beet import BubbleException, Cache, DataPack, ResourcePack, TextFile, TextFileBase
from beet import (
BubbleException,
Cache,
DataPack,
NamespaceFileScope,
ResourcePack,
TextFile,
TextFileBase,
)
from beet.core.utils import JsonDict, extra_field, import_from_string, required_field
from mecha import (
AstCacheBackend,
Expand Down Expand Up @@ -82,14 +90,14 @@ class SilentCompilationInterrupt(DiagnosticCollection):
class Module(TextFile):
"""Class representing a bolt module."""

scope: ClassVar[Tuple[str, ...]] = ("modules",)
scope: ClassVar[NamespaceFileScope] = ("modules",)
extension: ClassVar[str] = ".bolt"


class AssetModule(TextFile):
"""Class representing a bolt module in a resource pack."""

scope: ClassVar[Tuple[str, ...]] = ("modules",)
scope: ClassVar[NamespaceFileScope] = ("modules",)
extension: ClassVar[str] = ".bolt"


Expand Down
1 change: 0 additions & 1 deletion examples/bolt_1_20/beet.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
minecraft: "1.20"
require:
- bolt
data_pack:
Expand Down
4 changes: 2 additions & 2 deletions examples/bolt_basic/src/data/demo/functions/foo.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ rd.seed(42)
random_id = UUID(int=rd.getrandbits(128))
whitelist add random_id

other_id = UUID(int=rd.getrandbits(128))
attribute @s minecraft:generic.attack_speed modifier add other_id "double" 0.5 add_multiplied_total
other_id = "demo:double"
attribute @s minecraft:generic.attack_speed modifier add other_id 0.5 add_multiplied_total

x = 1
del x
Expand Down
4 changes: 2 additions & 2 deletions examples/bolt_custom_provider/custom_provider.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import ClassVar

from beet import Context, TextFile
from beet import Context, NamespaceFileScope, TextFile
from mecha import FileTypeCompilationUnitProvider, Mecha


class Custom(TextFile):
scope: ClassVar[tuple[str, ...]] = ("custom",)
scope: ClassVar[NamespaceFileScope] = ("custom",)
extension: ClassVar[str] = ".bolt"


Expand Down
11 changes: 9 additions & 2 deletions examples/bolt_overgen/overgen.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
from dataclasses import dataclass
from typing import Any, ClassVar, Iterable, List, Optional, Tuple, Union

from beet import Context, DataPack, ResourcePack, TextFile, TextFileBase
from beet import (
Context,
DataPack,
NamespaceFileScope,
ResourcePack,
TextFile,
TextFileBase,
)
from beet.core.utils import FormatsRangeDict, normalize_string
from mecha import CompilationDatabase, CompilationUnit, Mecha

from bolt import Runtime


class Overgen(TextFile):
scope: ClassVar[tuple[str, ...]] = ("overgen",)
scope: ClassVar[NamespaceFileScope] = ("overgen",)
extension: ClassVar[str] = ".bolt"


Expand Down
4 changes: 2 additions & 2 deletions examples/bolt_patchers/patchers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import ClassVar

from beet import Context, TextFile
from beet import Context, NamespaceFileScope, TextFile
from mecha import Mecha

from bolt import Runtime


class Patcher(TextFile):
scope: ClassVar[tuple[str, ...]] = ("patchers",)
scope: ClassVar[NamespaceFileScope] = ("patchers",)
extension: ClassVar[str] = ".bolt"


Expand Down
4 changes: 2 additions & 2 deletions examples/bolt_sample_ui/sample_ui/resources.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import ClassVar

from beet import Context, TextFileBase
from beet import Context, NamespaceFileScope, TextFileBase


class UiScreen(TextFileBase[str]):
scope: ClassVar[tuple[str, ...]] = ("ui_screens",)
scope: ClassVar[NamespaceFileScope] = ("ui_screens",)
extension: ClassVar[str] = ".xml"


Expand Down
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ include = ["bolt/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
beet = ">=0.105.0"
mecha = ">=0.94.0"
beet = ">=0.108.0"
mecha = ">=0.95.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.1"
black = "^24.2.0"
isort = "^5.13.2"
python-semantic-release = "^7.33.3"
pytest-insta = "^0.3.0"
lectern = ">=0.31.0"
lectern = ">=0.34.0"

[tool.poetry.plugins.beet]
commands = "bolt.commands"
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_230__0.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
macro foo:
pass
#>ERROR Expected colon, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 147 other tokens but got literal 'foo'.
#>ERROR Expected colon, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 158 other tokens but got literal 'foo'.
# line 3, column 7
# 2 | pass
# 3 | as @p foo
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_305__0.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#>ERROR Expected literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as', literal 'at' or 164 other tokens but got literal 'foo'.
#>ERROR Expected literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as', literal 'at' or 175 other tokens but got literal 'foo'.
# line 1, column 11
# 1 | as @a run foo = "bar"
# : ^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_352__0.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
macro hello thing=subcommand:
pass
#>ERROR Expected assignment, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 166 other tokens but got literal 'print(123)'.
#>ERROR Expected assignment, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 177 other tokens but got literal 'print(123)'.
# line 3, column 7
# 2 | pass
# 3 | hello print(123)
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_358__0.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#>ERROR Expected literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as', literal 'at' or 164 other tokens but got literal '"not'.
#>ERROR Expected literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as', literal 'at' or 175 other tokens but got literal '"not'.
# line 1, column 13
# 1 | execute run "not docstring"
# : ^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_48__0.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1 * 2
#>ERROR Expected bracket '[', curly '{', decorator, docstring, ellipsis, false or 177 other tokens but got literal '*'.
#>ERROR Expected bracket '[', curly '{', decorator, docstring, ellipsis, false or 188 other tokens but got literal '*'.
# line 2, column 1
# 1 | 1 * 2
# 2 | * 3
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/bolt__parse_99__0.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#>ERROR Expected colon, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 147 other tokens but got literal 'for'.
#>ERROR Expected colon, literal 'advancement', literal 'align', literal 'anchored', literal 'append', literal 'as' or 158 other tokens but got literal 'for'.
# line 1, column 7
# 1 | at @s for i in "foo":
# : ^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_1_20__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_assets__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 32,
"pack_format": 34,
"description": ""
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/snapshots/examples__build_bolt_basic__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@ say AstCommand(identifier='tellraw:targets:message', arguments=AstChildren((AstS
say tellraw @p "hello"
execute as 00000001-0002-0003-0405-000000000006 run function test:test
whitelist add bdd640fb-0667-1ad1-1c80-317fa3b1799d
attribute @s minecraft:generic.attack_speed modifier add 23b8c1e9-3924-56de-3eb1-3b9046685257 double 0.5 add_multiplied_total
attribute @s minecraft:generic.attack_speed modifier add demo:double 0.5 add_multiplied_total
```

`@function demo:import_a`
Expand Down Expand Up @@ -683,7 +683,7 @@ say json loaded!
```json
{
"pack": {
"pack_format": 32,
"pack_format": 34,
"description": ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_chicken__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_circular__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_class__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_debug__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_defer__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_docstring__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/examples__build_bolt_flat__0.pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```json
{
"pack": {
"pack_format": 41,
"pack_format": 48,
"description": ""
}
}
Expand Down
Loading

0 comments on commit d55c37d

Please sign in to comment.