spyrrow 0.5.0__cp311-cp311-musllinux_1_2_aarch64.whl → 0.7.0__cp311-cp311-musllinux_1_2_aarch64.whl

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.

Potentially problematic release.


This version of spyrrow might be problematic. Click here for more details.

spyrrow/__init__.pyi CHANGED
@@ -1,4 +1,5 @@
1
- from typing import TypeAlias
1
+ from typing import TypeAlias, Optional
2
+ from datetime import timedelta
2
3
 
3
4
  Point: TypeAlias = tuple[float, float]
4
5
 
@@ -13,29 +14,28 @@ class Item:
13
14
  id: str,
14
15
  shape: list[Point],
15
16
  demand: int,
16
- allowed_orientations: list[float],
17
+ allowed_orientations: list[float] | None,
17
18
  ):
18
19
  """
19
20
  An Item represents any closed 2D shape by its outer boundary.
20
21
 
21
22
  Spyrrow doesn't support hole(s) inside the shape as of yet. Therefore no Item can be nested inside another.
22
23
 
23
- Continous rotation is not supported as of yet. A workaround is to specify any integer degrees between 0 and 360
24
- to the allowed_orientations list.
25
-
26
24
  Args:
27
25
  id (str): The Item identifier
28
26
  Needs to be unique accross all Items of a StripPackingInstance
29
27
  shape: An ordered list of (x,y) defining the shape boundary. The shape is represented as a polygon formed by this list of points.
30
28
  The origin point can be included twice as the finishing point. If not, [last point, first point] is infered to be the last straight line of the shape.
31
29
  demand: The quantity of identical Items to be placed inside the strip. Should be positive.
32
- allowed_orientations: List of angles in degrees allowed. An empty list is equivalent to [0.].
30
+ allowed_orientations (list[float]|None): List of angles in degrees allowed.
31
+ An empty list is equivalent to [0.].
32
+ A None value means that the item is free to rotate
33
33
  The algorithmn is only very weakly sensible to the length of the list given.
34
34
 
35
35
  """
36
-
37
- def to_json_str(self)->str:
38
- """ Return a string of the JSON representation of the object"""
36
+
37
+ def to_json_str(self) -> str:
38
+ """Return a string of the JSON representation of the object"""
39
39
 
40
40
  class PlacedItem:
41
41
  """
@@ -68,6 +68,61 @@ class StripPackingSolution:
68
68
  density: float
69
69
  placed_items: list[PlacedItem]
70
70
 
71
+ class StripPackingConfig:
72
+ early_termination: bool
73
+ seed: int
74
+ exploration_time: timedelta
75
+ compression_time: timedelta
76
+ quadtree_depth: int
77
+ num_wokers:Optional[int]
78
+ min_items_separation: Optional[float]
79
+
80
+ def __init__(
81
+ self,
82
+ early_termination: bool = True,
83
+ quadtree_depth: int = 4,
84
+ min_items_separation: Optional[float] = None,
85
+ total_computation_time: Optional[int] = 600,
86
+ exploration_time: Optional[int] = None,
87
+ compression_time: Optional[int] = None,
88
+ num_wokers:Optional[int]= None,
89
+ seed: Optional[int] = None,
90
+ ) -> None:
91
+ """Initializes a configuration object for the strip packing algorithm.
92
+
93
+ Either `total_computation_time`, or both `exploration_time` and
94
+ `compression_time`, must be provided. Providing all three or only
95
+ one of the latter two raises an error.
96
+
97
+ If `total_computation_time` is provided, 80% of it is allocated to
98
+ exploration and 20% to compression.
99
+
100
+ If `seed` is not provided, a random seed will be generated.
101
+
102
+ Args:
103
+ early_termination (bool, optional): Whether to allow early termination of the algorithm. Defaults to True.
104
+ quadtree_depth (int, optional): Maximum depth of the quadtree used by the collision detection engine jagua-rs.
105
+ Must be positive, common values are 3,4,5. Defaults to 4.
106
+ min_items_separation (Optional[float], optional): Minimum required distance between packed items. Defaults to None.
107
+ total_computation_time (Optional[int], optional): Total time budget in seconds.
108
+ Used if `exploration_time` and `compression_time` are not provided. Defaults to 600.
109
+ exploration_time (Optional[int], optional): Time in seconds allocated to exploration. Defaults to None.
110
+ compression_time (Optional[int], optional): Time in seconds allocated to compression. Defaults to None.
111
+ num_workers (Optional[int], optional): Number of threads used by the collision detection engine during exploration.
112
+ When set to None, detect the number of logical CPU cores on the execution plateform. Defaults to None.
113
+ seed (Optional[int], optional): Optional random seed to give reproductibility. If None, a random seed is generated. Defaults to None.
114
+
115
+ Raises:
116
+ ValueError: If the combination of time arguments is invalid.
117
+ """
118
+
119
+ def to_json_str(self)->str:
120
+ """Return a string of the JSON representation of the object
121
+
122
+ Returns:
123
+ str
124
+ """
125
+
71
126
  class StripPackingInstance:
72
127
  name: str
73
128
  strip_height: float
@@ -85,17 +140,15 @@ class StripPackingInstance:
85
140
  Raises:
86
141
  ValueError
87
142
  """
88
- def to_json_str(self)->str:
89
- """ Return a string of the JSON representation of the object"""
90
-
143
+ def to_json_str(self) -> str:
144
+ """Return a string of the JSON representation of the object"""
91
145
 
92
- def solve(self, computation_time: int = 600) -> StripPackingSolution:
146
+ def solve(self, config: StripPackingConfig) -> StripPackingSolution:
93
147
  """
94
148
  The method to solve the instance.
95
149
 
96
150
  Args:
97
- computation_time (int): The total computation time in seconds used to find a solution.
98
- The algorithm won't exit early.Waht you input is what you get. Default is 600 s = 10 minutes.
151
+ config (StripPackingConfig): the config object to precise behavior of how to solve the strip packing instance.
99
152
 
100
153
  Returns:
101
154
  a StripPackingSolution
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: spyrrow
3
+ Version: 0.7.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE.txt
8
+ Author-email: Paul Durand-Lupinski <paul.durand-lupinski@reeverse-systems.com>
9
+ Requires-Python: >=3.10
10
+ Project-URL: documentation, https://spyrrow.readthedocs.io/
11
+ Project-URL: source, https://github.com/PaulDL-RS/spyrrow
@@ -0,0 +1,9 @@
1
+ spyrrow-0.7.0.dist-info/METADATA,sha256=_HbJhdU3i7M7iN6o3jQYkVSYRJCi2aohSvGBA5ogvOk,480
2
+ spyrrow-0.7.0.dist-info/WHEEL,sha256=xgMGzswzbwKwgKUg-kB8HNicNIzQYqJzMcClthXR1Y0,108
3
+ spyrrow-0.7.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
+ spyrrow.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
5
+ spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
6
+ spyrrow/__init__.pyi,sha256=9op4JPXX9L4-MAGMGDGIfQsc93Ch2p5CUsuT6xDUmeo,6453
7
+ spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ spyrrow/spyrrow.cpython-311-aarch64-linux-musl.so,sha256=QRR5AgSyq8Jy5dqAXtwriuBW-4UC1pa3TV9U_pyJeOQ,2034769
9
+ spyrrow-0.7.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.8.7)
2
+ Generator: maturin (1.9.4)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-musllinux_1_2_aarch64
@@ -1,68 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: spyrrow
3
- Version: 0.5.0
4
- Classifier: Programming Language :: Rust
5
- Classifier: Programming Language :: Python :: Implementation :: CPython
6
- Classifier: Programming Language :: Python :: Implementation :: PyPy
7
- License-File: LICENSE.txt
8
- Author-email: Paul Durand-Lupinski <paul.durand-lupinski@reeverse-systems.com>
9
- License: MIT
10
- Requires-Python: >=3.10
11
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
- Project-URL: documentation, https://spyrrow.readthedocs.io/
13
- Project-URL: source, https://github.com/PaulDL-RS/spyrrow
14
-
15
- # Spyrrow
16
-
17
- `spyrrow` is a Python wrapper on the Rust project [`sparrow`](https://github.com/JeroenGar/sparrow).
18
- It enables to solve 2D [Strip packing problems](https://en.wikipedia.org/wiki/Strip_packing_problem).
19
-
20
- The documentation is hosted [here](https://spyrrow.readthedocs.io/).
21
-
22
- ## Installation
23
-
24
- Spyrrow is hosted on [PyPI](https://pypi.org/project/spyrrow/).
25
-
26
- You can install with the package manager of your choice, using the PyPI package index.
27
-
28
- For example, with `pip`, the default Python package:
29
- ```bash
30
- pip install spyrrow
31
- ```
32
-
33
- ## Examples
34
- ```python
35
- import spyrrow
36
-
37
- rectangle1 = spyrrow.Item(
38
- "rectangle", [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], demand=4, allowed_orientations=[0]
39
- )
40
- triangle1 = spyrrow.Item(
41
- "triangle",
42
- [(0, 0), (1, 0), (1, 1), (0, 0)],
43
- demand=6,
44
- allowed_orientations=[0, 90, 180, -90],
45
- )
46
-
47
- instance = spyrrow.StripPackingInstance("test", strip_height=2.001, items=[rectangle1,triangle1])
48
- sol:spyrrow.StripPackingSolution = instance.solve(30)
49
- print(sol.width)
50
- print(sol.density)
51
- print("\n")
52
- for pi in sol.placed_items:
53
- print(pi.id)
54
- print(pi.rotation)
55
- print(pi.translation)
56
- print("\n")
57
- ```
58
-
59
- ## Contributing
60
-
61
- Spyrrow is open to contributions.
62
- The first target should be to reach Python open sources packages standards and practices.
63
- Second, a easier integration with the package `shapely` is envsionned.
64
-
65
- Please use GitHub issues to request features.
66
- They will be considered relative to what is already implemented in the parent library `sparrow`.
67
- If necessary, they can be forwarded to it.
68
-
@@ -1,9 +0,0 @@
1
- spyrrow-0.5.0.dist-info/METADATA,sha256=EZ7iHM1m1vZwrtCdysrc_Z8jl-TFPOlZS8y7vUSWqeQ,2156
2
- spyrrow-0.5.0.dist-info/WHEEL,sha256=4KjY_ZR27kMkX5gtruwBG_t6p6hJa1OSoUF-wzwJLyU,108
3
- spyrrow-0.5.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
- spyrrow.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
5
- spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
6
- spyrrow/__init__.pyi,sha256=2r0Dy-uJY0lE4Q_-eT7E2aOx9965J4JQ9G9xwZv4zXY,3947
7
- spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- spyrrow/spyrrow.cpython-311-aarch64-linux-musl.so,sha256=CugvIkINoW-3vDSsYHCZVAROZNaIYSkHqJYVkdgN_f0,1903641
9
- spyrrow-0.5.0.dist-info/RECORD,,