spyrrow 0.6.0__cp313-cp313t-musllinux_1_2_i686.whl → 0.7.0__cp313-cp313t-musllinux_1_2_i686.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
 
@@ -67,6 +68,61 @@ class StripPackingSolution:
67
68
  density: float
68
69
  placed_items: list[PlacedItem]
69
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
+
70
126
  class StripPackingInstance:
71
127
  name: str
72
128
  strip_height: float
@@ -87,13 +143,12 @@ class StripPackingInstance:
87
143
  def to_json_str(self) -> str:
88
144
  """Return a string of the JSON representation of the object"""
89
145
 
90
- def solve(self, computation_time: int = 600) -> StripPackingSolution:
146
+ def solve(self, config: StripPackingConfig) -> StripPackingSolution:
91
147
  """
92
148
  The method to solve the instance.
93
149
 
94
150
  Args:
95
- computation_time (int): The total computation time in seconds used to find a solution.
96
- 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.
97
152
 
98
153
  Returns:
99
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=NFo86IM_WtVR-TFY-Pc6byqaWwE8xyk54G9_i5f5pvE,106
3
+ spyrrow-0.7.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
+ spyrrow.libs/libgcc_s-b5472b99.so.1,sha256=wh8CpjXz9IccAyeERcB7YDEx7NH2jF-PykwOyYNeRRI,453841
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-313t-i386-linux-musl.so,sha256=wymq_lwwp0lKuwzPomec7iIUhhpOEPGXDsHMHIGIH7U,1809341
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: cp313-cp313t-musllinux_1_2_i686
@@ -1,68 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: spyrrow
3
- Version: 0.6.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.6.0.dist-info/METADATA,sha256=hTkD2cL-edcgg30N50h0bCmFoB1y_gsrgevJWp76_iY,2156
2
- spyrrow-0.6.0.dist-info/WHEEL,sha256=IS9kcek0uKuKi-dC9I7ZjRAqVJdiqePDtTjVrFEd0Pg,106
3
- spyrrow-0.6.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
- spyrrow.libs/libgcc_s-b5472b99.so.1,sha256=wh8CpjXz9IccAyeERcB7YDEx7NH2jF-PykwOyYNeRRI,453841
5
- spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
6
- spyrrow/__init__.pyi,sha256=NqgZwO1Kh-acAVTdl6Z2YVhKLcCIF6GRHy2V_oZgJNc,3885
7
- spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- spyrrow/spyrrow.cpython-313t-i386-linux-musl.so,sha256=jNvPkqMIDtdFfQar8wmjWGcCVCfTtGfotBsmHhDVvYw,1727313
9
- spyrrow-0.6.0.dist-info/RECORD,,