Skip to content

Commit dc592d6

Browse files
Update pybind11 and enable meta build (#418)
* Update dependencies * Enable meta build * Update stubs
1 parent e43a573 commit dc592d6

File tree

18 files changed

+216
-64
lines changed

18 files changed

+216
-64
lines changed

requirements.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
AMULET_COMPILER_TARGET_REQUIREMENT = "==2.0"
55
AMULET_COMPILER_VERSION_REQUIREMENT = "==3.0.0"
66

7-
PYBIND11_REQUIREMENT = "==2.13.6"
7+
PYBIND11_REQUIREMENT = "==3.0.0"
88
AMULET_PYBIND11_EXTENSIONS_REQUIREMENT = "~=1.1.0.0a0"
99
AMULET_IO_REQUIREMENT = "~=1.0"
10-
AMULET_ZLIB_REQUIREMENT = "~=1.0.0.0a7"
11-
AMULET_NBT_REQUIREMENT = "~=5.0.0.0a7"
10+
AMULET_ZLIB_REQUIREMENT = "~=1.0.1.0a0"
11+
AMULET_NBT_REQUIREMENT = "~=5.0.1.0a0"
1212
NUMPY_REQUIREMENT = "~=2.0"
1313

1414
if os.environ.get("AMULET_PYBIND11_EXTENSIONS_REQUIREMENT", None):

src/amulet/core/__init__.pyi

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from __future__ import annotations
2+
3+
from . import (
4+
_amulet_core,
5+
_version,
6+
biome,
7+
block,
8+
block_entity,
9+
chunk,
10+
entity,
11+
palette,
12+
selection,
13+
version,
14+
)
15+
16+
__all__ = [
17+
"biome",
18+
"block",
19+
"block_entity",
20+
"chunk",
21+
"compiler_config",
22+
"entity",
23+
"palette",
24+
"selection",
25+
"version",
26+
]
27+
28+
def _init() -> None: ...
29+
30+
__version__: str
31+
compiler_config: dict

src/amulet/core/block/__init__.pyi

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Block(amulet.core.version.PlatformVersionContainer):
3737
>>> )
3838
"""
3939

40-
PropertyValue: typing.TypeAlias = (
40+
PropertyValue: typing.ClassVar[typing.TypeAlias] = (
4141
amulet.nbt.ByteTag
4242
| amulet.nbt.ShortTag
4343
| amulet.nbt.IntTag
@@ -89,7 +89,7 @@ class Block(amulet.core.version.PlatformVersionContainer):
8989
version: amulet.core.version.VersionNumber,
9090
namespace: str,
9191
base_name: str,
92-
properties: dict[
92+
properties: collections.abc.Mapping[
9393
str,
9494
amulet.nbt.ByteTag
9595
| amulet.nbt.ShortTag
@@ -223,7 +223,7 @@ class BlockStack:
223223
def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
224224
def __ge__(self, arg0: BlockStack) -> bool: ...
225225
@typing.overload
226-
def __getitem__(self, arg0: int) -> Block: ...
226+
def __getitem__(self, arg0: typing.SupportsInt) -> Block: ...
227227
@typing.overload
228228
def __getitem__(self, arg0: slice) -> list: ...
229229
def __gt__(self, arg0: BlockStack) -> bool: ...
@@ -237,7 +237,10 @@ class BlockStack:
237237
def __reversed__(self) -> collections.abc.Iterator[Block]: ...
238238
def count(self, value: typing.Any) -> int: ...
239239
def index(
240-
self, value: typing.Any, start: int = 0, stop: int = 9223372036854775807
240+
self,
241+
value: typing.Any,
242+
start: typing.SupportsInt = 0,
243+
stop: typing.SupportsInt = 9223372036854775807,
241244
) -> int: ...
242245
@property
243246
def base_block(self) -> Block:

src/amulet/core/chunk/component/block_component.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class BlockComponentData:
1717
def __init__(
1818
self,
1919
version_range: amulet.core.version.VersionRange,
20-
array_shape: tuple[int, int, int],
20+
array_shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
2121
default_block: amulet.core.block.BlockStack,
2222
) -> None: ...
2323
@property

src/amulet/core/chunk/component/section_array_map.pyi

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import typing
66

77
import numpy
88
import numpy.typing
9-
import typing_extensions
109

1110
__all__ = ["IndexArray3D", "SectionArrayMap"]
1211

@@ -16,13 +15,19 @@ class IndexArray3D:
1615
"""
1716

1817
@typing.overload
19-
def __init__(self, shape: tuple[int, int, int]) -> None: ...
18+
def __init__(
19+
self, shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt]
20+
) -> None: ...
2021
@typing.overload
21-
def __init__(self, shape: tuple[int, int, int], value: int) -> None: ...
22+
def __init__(
23+
self,
24+
shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
25+
value: typing.SupportsInt,
26+
) -> None: ...
2227
@typing.overload
2328
def __init__(self, other: IndexArray3D) -> None: ...
2429
@typing.overload
25-
def __init__(self, arg0: typing_extensions.Buffer) -> None: ...
30+
def __init__(self, arg0: collections.abc.Buffer) -> None: ...
2631
@property
2732
def shape(self) -> tuple[int, int, int]: ...
2833
@property
@@ -33,35 +38,48 @@ class SectionArrayMap:
3338
A container of sub-chunk arrays.
3439
"""
3540

36-
def __contains__(self, arg0: int) -> bool: ...
37-
def __delitem__(self, arg0: int) -> None: ...
41+
def __contains__(self, arg0: typing.SupportsInt) -> bool: ...
42+
def __delitem__(self, arg0: typing.SupportsInt) -> None: ...
3843
def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
39-
def __getitem__(self, arg0: int) -> numpy.typing.NDArray[numpy.uint32]: ...
44+
def __getitem__(
45+
self, arg0: typing.SupportsInt
46+
) -> numpy.typing.NDArray[numpy.uint32]: ...
4047
def __hash__(self) -> int: ...
4148
def __init__(
4249
self,
43-
array_shape: tuple[int, int, int],
44-
default_array: int | IndexArray3D | typing_extensions.Buffer,
50+
array_shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
51+
default_array: (
52+
typing.SupportsInt
53+
| amulet.core.chunk.component.section_array_map.IndexArray3D
54+
| collections.abc.Buffer
55+
),
4556
) -> None: ...
4657
def __iter__(self) -> collections.abc.Iterator[int]: ...
4758
def __len__(self) -> int: ...
4859
def __setitem__(
49-
self, arg0: int, arg1: IndexArray3D | typing_extensions.Buffer
60+
self,
61+
arg0: typing.SupportsInt,
62+
arg1: (
63+
amulet.core.chunk.component.section_array_map.IndexArray3D
64+
| collections.abc.Buffer
65+
),
5066
) -> None: ...
5167
def get(
52-
self, key: int, default: numpy.typing.NDArray[numpy.uint32] | None = None
68+
self,
69+
key: typing.SupportsInt,
70+
default: numpy.typing.NDArray[numpy.uint32] | None = None,
5371
) -> numpy.typing.NDArray[numpy.uint32] | None: ...
5472
def items(
5573
self,
5674
) -> collections.abc.ItemsView[int, numpy.typing.NDArray[numpy.uint32]]: ...
5775
def keys(self) -> collections.abc.KeysView[int]: ...
5876
def pop(
59-
self, key: int, default: numpy.typing.NDArray[numpy.uint32] = ...
77+
self, key: typing.SupportsInt, default: numpy.typing.NDArray[numpy.uint32] = ...
6078
) -> numpy.typing.NDArray[numpy.uint32]: ...
6179
def popitem(self) -> tuple[int, numpy.typing.NDArray[numpy.uint32]]: ...
62-
def populate(self, arg0: int) -> None: ...
80+
def populate(self, arg0: typing.SupportsInt) -> None: ...
6381
def setdefault(
64-
self, arg0: int, arg1: numpy.typing.NDArray[numpy.uint32] | None
82+
self, arg0: typing.SupportsInt, arg1: numpy.typing.NDArray[numpy.uint32] | None
6583
) -> numpy.typing.NDArray[numpy.uint32] | None: ...
6684
def update(self, other: typing.Any = (), **kwargs: typing.Any) -> None: ...
6785
def values(
@@ -73,5 +91,10 @@ class SectionArrayMap:
7391
def default_array(self) -> int | numpy.ndarray: ...
7492
@default_array.setter
7593
def default_array(
76-
self, arg1: int | IndexArray3D | typing_extensions.Buffer
94+
self,
95+
arg1: (
96+
typing.SupportsInt
97+
| amulet.core.chunk.component.section_array_map.IndexArray3D
98+
| collections.abc.Buffer
99+
),
77100
) -> None: ...

src/amulet/core/entity/__init__.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class Entity(amulet.core.version.PlatformVersionContainer):
2424
version: amulet.core.version.VersionNumber,
2525
namespace: str,
2626
base_name: str,
27-
x: float,
28-
y: float,
29-
z: float,
27+
x: typing.SupportsFloat,
28+
y: typing.SupportsFloat,
29+
z: typing.SupportsFloat,
3030
nbt: amulet.nbt.NamedTag,
3131
) -> None: ...
3232
def __repr__(self) -> str: ...
@@ -86,20 +86,20 @@ class Entity(amulet.core.version.PlatformVersionContainer):
8686
"""
8787

8888
@x.setter
89-
def x(self, arg1: float) -> None: ...
89+
def x(self, arg1: typing.SupportsFloat) -> None: ...
9090
@property
9191
def y(self) -> float:
9292
"""
9393
The y coordinate of the entity.
9494
"""
9595

9696
@y.setter
97-
def y(self, arg1: float) -> None: ...
97+
def y(self, arg1: typing.SupportsFloat) -> None: ...
9898
@property
9999
def z(self) -> float:
100100
"""
101101
The z coordinate of the entity.
102102
"""
103103

104104
@z.setter
105-
def z(self, arg1: float) -> None: ...
105+
def z(self, arg1: typing.SupportsFloat) -> None: ...

src/amulet/core/palette/biome_palette.pyi

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ __all__ = ["BiomePalette"]
1010

1111
class BiomePalette(amulet.core.version.VersionRangeContainer):
1212
@typing.overload
13-
def __contains__(self, arg0: int) -> bool: ...
13+
def __contains__(self, arg0: typing.SupportsInt) -> bool: ...
1414
@typing.overload
1515
def __contains__(self, arg0: amulet.core.biome.Biome) -> bool: ...
1616
@typing.overload
17-
def __getitem__(self, arg0: int) -> amulet.core.biome.Biome: ...
17+
def __getitem__(self, arg0: typing.SupportsInt) -> amulet.core.biome.Biome: ...
1818
@typing.overload
1919
def __getitem__(self, arg0: slice) -> list: ...
2020
def __init__(self, arg0: amulet.core.version.VersionRange) -> None: ...
@@ -33,9 +33,12 @@ class BiomePalette(amulet.core.version.VersionRangeContainer):
3333

3434
def count(self, value: typing.Any) -> int: ...
3535
def index(
36-
self, value: typing.Any, start: int = 0, stop: int = 9223372036854775807
36+
self,
37+
value: typing.Any,
38+
start: typing.SupportsInt = 0,
39+
stop: typing.SupportsInt = 9223372036854775807,
3740
) -> int: ...
38-
def index_to_biome(self, arg0: int) -> amulet.core.biome.Biome:
41+
def index_to_biome(self, arg0: typing.SupportsInt) -> amulet.core.biome.Biome:
3942
"""
4043
Get the biome at the specified palette index.
4144

src/amulet/core/palette/block_palette.pyi

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ __all__ = ["BlockPalette"]
1010

1111
class BlockPalette(amulet.core.version.VersionRangeContainer):
1212
@typing.overload
13-
def __contains__(self, arg0: int) -> bool: ...
13+
def __contains__(self, arg0: typing.SupportsInt) -> bool: ...
1414
@typing.overload
1515
def __contains__(self, arg0: amulet.core.block.BlockStack) -> bool: ...
1616
@typing.overload
17-
def __getitem__(self, arg0: int) -> amulet.core.block.BlockStack: ...
17+
def __getitem__(self, arg0: typing.SupportsInt) -> amulet.core.block.BlockStack: ...
1818
@typing.overload
1919
def __getitem__(self, arg0: slice) -> list: ...
2020
def __init__(self, arg0: amulet.core.version.VersionRange) -> None: ...
@@ -35,9 +35,14 @@ class BlockPalette(amulet.core.version.VersionRangeContainer):
3535

3636
def count(self, value: typing.Any) -> int: ...
3737
def index(
38-
self, value: typing.Any, start: int = 0, stop: int = 9223372036854775807
38+
self,
39+
value: typing.Any,
40+
start: typing.SupportsInt = 0,
41+
stop: typing.SupportsInt = 9223372036854775807,
3942
) -> int: ...
40-
def index_to_block_stack(self, arg0: int) -> amulet.core.block.BlockStack:
43+
def index_to_block_stack(
44+
self, arg0: typing.SupportsInt
45+
) -> amulet.core.block.BlockStack:
4146
"""
4247
Get the block stack at the specified palette index.
4348

src/amulet/core/selection/box.pyi

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ class SelectionBox:
2323
def __hash__(self) -> int: ...
2424
@typing.overload
2525
def __init__(
26-
self, min_x: int, min_y: int, min_z: int, size_x: int, size_y: int, size_z: int
26+
self,
27+
min_x: typing.SupportsInt,
28+
min_y: typing.SupportsInt,
29+
min_z: typing.SupportsInt,
30+
size_x: typing.SupportsInt,
31+
size_y: typing.SupportsInt,
32+
size_z: typing.SupportsInt,
2733
) -> None:
2834
"""
2935
Construct a new SelectionBox instance.
@@ -41,7 +47,9 @@ class SelectionBox:
4147

4248
@typing.overload
4349
def __init__(
44-
self, point_1: tuple[int, int, int], point_2: tuple[int, int, int]
50+
self,
51+
point_1: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
52+
point_2: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
4553
) -> None:
4654
"""
4755
Construct a new SelectionBox instance.
@@ -57,7 +65,9 @@ class SelectionBox:
5765
def __lt__(self, arg0: SelectionBox) -> bool: ...
5866
def __repr__(self) -> str: ...
5967
def __str__(self) -> str: ...
60-
def contains_block(self, x: int, y: int, z: int) -> bool:
68+
def contains_block(
69+
self, x: typing.SupportsInt, y: typing.SupportsInt, z: typing.SupportsInt
70+
) -> bool:
6171
"""
6272
Is the block contained within the selection.
6373
@@ -79,7 +89,9 @@ class SelectionBox:
7989
:return: True if other fits in self, False otherwise.
8090
"""
8191

82-
def contains_point(self, x: float, y: float, z: float) -> bool:
92+
def contains_point(
93+
self, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat
94+
) -> bool:
8395
"""
8496
Is the point contained within the selection.
8597
@@ -120,7 +132,9 @@ class SelectionBox:
120132
:return: True if the two :class:`SelectionBox` instances touch or intersect, False otherwise.
121133
"""
122134

123-
def translate(self, x: int, y: int, z: int) -> SelectionBox:
135+
def translate(
136+
self, x: typing.SupportsInt, y: typing.SupportsInt, z: typing.SupportsInt
137+
) -> SelectionBox:
124138
"""
125139
Create a new :class:`SelectionBox` based on this one with the coordinates moved by the given offset.
126140

0 commit comments

Comments
 (0)