spyrrow 0.6.0__cp311-cp311-musllinux_1_2_x86_64.whl → 0.7.2__cp311-cp311-musllinux_1_2_x86_64.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,59 @@ 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 `compression_time`, must be provided.
94
+ Providing all three or only one of the latter two raises an error.
95
+ If `total_computation_time` is provided, 80% of it is allocated to exploration and 20% to compression.
96
+ If `seed` is not provided, a random seed will be generated.
97
+
98
+
99
+ Args:
100
+ early_termination (bool, optional): Whether to allow early termination of the algorithm. Defaults to True.
101
+ quadtree_depth (int, optional): Maximum depth of the quadtree used by the collision detection engine jagua-rs.
102
+ Must be positive, common values are 3,4,5. Defaults to 4.
103
+ min_items_separation (Optional[float], optional): Minimum required distance between packed items. Defaults to None.
104
+ total_computation_time (Optional[int], optional): Total time budget in seconds.
105
+ Used if `exploration_time` and `compression_time` are not provided. Defaults to 600.
106
+ exploration_time (Optional[int], optional): Time in seconds allocated to exploration. Defaults to None.
107
+ compression_time (Optional[int], optional): Time in seconds allocated to compression. Defaults to None.
108
+ num_workers (Optional[int], optional): Number of threads used by the collision detection engine during exploration.
109
+ When set to None, detect the number of logical CPU cores on the execution plateform. Defaults to None.
110
+ seed (Optional[int], optional): Optional random seed to give reproductibility. If None, a random seed is generated. Defaults to None.
111
+
112
+ Raises:
113
+ ValueError: If the combination of time arguments is invalid.
114
+
115
+ """
116
+
117
+ def to_json_str(self)->str:
118
+ """Return a string of the JSON representation of the object
119
+
120
+ Returns:
121
+ str
122
+ """
123
+
70
124
  class StripPackingInstance:
71
125
  name: str
72
126
  strip_height: float
@@ -87,13 +141,12 @@ class StripPackingInstance:
87
141
  def to_json_str(self) -> str:
88
142
  """Return a string of the JSON representation of the object"""
89
143
 
90
- def solve(self, computation_time: int = 600) -> StripPackingSolution:
144
+ def solve(self, config: StripPackingConfig) -> StripPackingSolution:
91
145
  """
92
146
  The method to solve the instance.
93
147
 
94
148
  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.
149
+ config (StripPackingConfig): The configuration object to control how the instance is solved.
97
150
 
98
151
  Returns:
99
152
  a StripPackingSolution
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: spyrrow
3
+ Version: 0.7.2
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.2.dist-info/METADATA,sha256=Pe7I5ZZbd4Jj4-HCfs6kiuMLnGvThviz9f-ixTd75u8,480
2
+ spyrrow-0.7.2.dist-info/WHEEL,sha256=4AHAltwFbkmLYCovWh433RDIDonhXBV3e1-avrmXJQg,107
3
+ spyrrow-0.7.2.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
+ spyrrow.libs/libgcc_s-98a1ef30.so.1,sha256=XOVRhHznCIpbSdhFoozhla-OfRqBtXftKPQ4cSMKjrs,433441
5
+ spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
6
+ spyrrow/__init__.pyi,sha256=MLil3REeOB6pTHvHX4CHKJ6m6chBQ-vCUm4theR8wq4,6430
7
+ spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ spyrrow/spyrrow.cpython-311-x86_64-linux-musl.so,sha256=8PD7UIDhVpHUl2Dr4V9ckPSgh-zP7H6rQPjEc__vUhU,1961049
9
+ spyrrow-0.7.2.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_x86_64
@@ -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=thThzBB4gSWx3fROzxY06Sf5oNWeNLw4Ow-HdbLhZb8,107
3
- spyrrow-0.6.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
- spyrrow.libs/libgcc_s-1e52349c.so.1,sha256=Ani0u_W_tB8ESsFePO4D2mn2lrgWLhyFdw6RETxBTYM,437537
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-311-x86_64-linux-musl.so,sha256=VAViFcQO04MNJZa-pVk_ENvVR7FT6SqbhFjXLaIdKbk,1858593
9
- spyrrow-0.6.0.dist-info/RECORD,,