microecs 0.3.7__tar.gz → 0.3.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microecs
3
- Version: 0.3.7
3
+ Version: 0.3.9
4
4
  Summary: MicroECS: Minimal Entity Component System (ECS) in python and numpy
5
5
  Home-page: https://gitlab.com/meehai/microecs
6
6
  License: MIT
@@ -1,8 +1,9 @@
1
1
  """init file"""
2
2
 
3
- from .component import Component
4
- from .pool import Pool
5
- from .query_result import QueryResult
6
3
  from .world import World
4
+ from .query_result import QueryResult
5
+ from .pool import Pool
6
+ from .component import Component
7
+ from .utils import EntityData, EntityId
7
8
 
8
- __all__ = ["Component", "Pool", "QueryResult", "World"]
9
+ __all__ = ["World", "QueryResult", "Pool", "Component", "EntityData", "EntityId"]
@@ -96,14 +96,14 @@ class _Field(np.lib.mixins.NDArrayOperatorsMixin):
96
96
  return f"[Field] Shape: {self.shape} (across {len(self.parts)} pools)"
97
97
 
98
98
  class QueryResult:
99
- """A list of pools seen as a contiguous view. Fields (qr.position) implement array interface to look like numpy"""
99
+ """A query result containing entities. Fields (e.g. qr.position) implement array interface to look like numpy"""
100
100
  def __init__(self, pool_list: list[Pool], field_shapes: dict[str, Shape], field_dtypes: dict[str, np.dtype],
101
101
  entity_ids: np.ndarray):
102
102
  self.pool_list = pool_list
103
103
  self.entity_ids = entity_ids
104
+ self.fields = list(field_shapes)
104
105
  self._field_shapes = field_shapes
105
106
  self._field_dtypes = field_dtypes
106
- self._fields = list(field_shapes)
107
107
  self._data: dict[str, np.ndarray] = {f: [p.data[f][0:len(p)] for p in pool_list] for f in field_shapes.keys()}
108
108
  self._len = sum(len(pool) for pool in self.pool_list)
109
109
 
@@ -111,7 +111,7 @@ class QueryResult:
111
111
  if (data := self.__dict__.get("_data")) is not None and name in data:
112
112
  # the 'or' part is in case no pools match the query and we want qr.position[:] += 1 still to work (noop)
113
113
  return _Field(data[name] or [np.empty((0, *self._field_shapes[name]), self._field_dtypes[name])])
114
- raise AttributeError(f"'{name}' not part of {self._fields}")
114
+ raise AttributeError(f"'{name}' not part of {self.fields}")
115
115
 
116
116
  def __setattr__(self, name, value):
117
117
  if (data := self.__dict__.get("_data")) is not None and name in data:
@@ -124,5 +124,5 @@ class QueryResult:
124
124
 
125
125
  def __repr__(self):
126
126
  return (f"[QueryResult]\n- Entities: {len(self.entity_ids)} (pools: {len(self.pool_list)})"
127
- f"\n- Fields: {self._fields}"
127
+ f"\n- Fields: {self.fields}"
128
128
  f"\n- Shapes: {list(self._field_shapes.values())}\n- Dtypes: {list(self._field_dtypes.values())}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microecs
3
- Version: 0.3.7
3
+ Version: 0.3.9
4
4
  Summary: MicroECS: Minimal Entity Component System (ECS) in python and numpy
5
5
  Home-page: https://gitlab.com/meehai/microecs
6
6
  License: MIT
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  NAME = "microecs"
6
- VERSION = "0.3.7"
6
+ VERSION = "0.3.9"
7
7
  DESCRIPTION = "MicroECS: Minimal Entity Component System (ECS) in python and numpy"
8
8
  URL = "https://gitlab.com/meehai/microecs"
9
9
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes