spyrrow 0.2.0__cp313-cp313-macosx_11_0_arm64.whl → 0.4.0__cp313-cp313-macosx_11_0_arm64.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
@@ -14,23 +14,91 @@ class Item:
14
14
  shape: list[Point],
15
15
  demand: int,
16
16
  allowed_orientations: list[float],
17
- ): ...
17
+ ):
18
+ """
19
+ An Item represents any closed 2D shape by its outer boundary.
20
+
21
+ Spyrrow doesn't support hole(s) inside the shape as of yet. Therefore no Item can be nested inside another.
22
+
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
+ Args:
27
+ id: The Item identifier for a given StripPackingInstance.
28
+ Best autoincremented as the instance verifies that all ids are presents starting from 0.
29
+ 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
+ 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
+ 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.].
33
+ The algorithmn is only very weakly sensible to the length of the list given.
34
+
35
+ """
36
+
37
+ def to_json_str(self)->str:
38
+ """ Return a string of the JSON representation of the object"""
18
39
 
19
40
  class PlacedItem:
41
+ """
42
+ An object representing where a copy of an Item was placed inside the strip.
43
+
44
+ Attributes:
45
+ id (int): The Item identifier for a given StripPackingInstance.
46
+ translation (tuple[float,float]): the translation vector in the X-Y axis
47
+ rotation (float): The roation angle in degrees, assuming that the original Item was defined with 0° as its rotation angle.
48
+ """
49
+
20
50
  id: int
21
51
  shape: list[Point]
22
52
  translation: Point
23
53
  rotation: float
24
54
 
25
55
  class StripPackingSolution:
56
+ """
57
+ An object representing the solution to a given StripPackingInstance.
58
+
59
+ Can not be directly instanciated. Result from StripPackingInstance.solve.
60
+
61
+ Attributes:
62
+ width (float): the width of the strip found to contains all Items. In the same unit as input.
63
+ placed_items (list[PlacedItem]): a list of all PlacedItems, describing how Items are placed in the solution
64
+ density (float): the fraction of the final strip used by items.
65
+ """
66
+
26
67
  width: float
27
68
  density: float
28
69
  placed_items: list[PlacedItem]
29
70
 
30
71
  class StripPackingInstance:
31
72
  name: str
32
- height: float
73
+ strip_height: float
33
74
  items: list[Item]
34
75
 
35
- def __init__(self, name: str, height: float, items: list[Item]): ...
36
- def solve(self, computation_time: int = 600) -> StripPackingSolution: ...
76
+ def __init__(self, name: str, strip_height: float, items: list[Item]):
77
+ """
78
+ An Instance of a Strip Packing Problem.
79
+
80
+ Args:
81
+ name (str): The name of the instance. Required by the underlying sparrow library.
82
+ An empty string '' can be used, if the user doesn't have a use for this name.
83
+ strip_height (float): the fixed height of the strip. The unit should be compatible with the Item
84
+ items (list[Item]): The Items which defines the instances. All Items should be defined with the same scale ( same length unit).
85
+ Items ids should be an increasing series starting at 0 until len(items)-1.
86
+
87
+ Raises:
88
+ ValueError
89
+ """
90
+ def to_json_str(self)->str:
91
+ """ Return a string of the JSON representation of the object"""
92
+
93
+
94
+ def solve(self, computation_time: int = 600) -> StripPackingSolution:
95
+ """
96
+ The method to solve the instance.
97
+
98
+ Args:
99
+ computation_time (int): The total computation time in seconds used to find a solution.
100
+ The algorithm won't exit early.Waht you input is what you get. Default is 600 s = 10 minutes.
101
+
102
+ Returns:
103
+ a StripPackingSolution
104
+ """
Binary file
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: spyrrow
3
+ Version: 0.4.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
+ 0, [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], demand=4, allowed_orientations=[0]
39
+ )
40
+ triangle1 = spyrrow.Item(
41
+ 1,
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
+
@@ -0,0 +1,8 @@
1
+ spyrrow-0.4.0.dist-info/METADATA,sha256=xISpeyAxcBngcjpXGDIIwv7I3AfHo56GUUpwojWvk5A,2136
2
+ spyrrow-0.4.0.dist-info/WHEEL,sha256=UPfJ7S-gMCqCJ6cj5sliE010L87pWgiShNoxmys5TN4,104
3
+ spyrrow-0.4.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
+ spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
5
+ spyrrow/__init__.pyi,sha256=MZXI5_RK5wSwDwPSZIV-m75mgi_ZW35MQuPQVpAiFHc,4010
6
+ spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ spyrrow/spyrrow.cpython-313-darwin.so,sha256=ZVYOEvpZIDd282VpZRCQC0JgL8oUH6VoUp7xMyzTnt4,1381072
8
+ spyrrow-0.4.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.8.4)
2
+ Generator: maturin (1.8.6)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp313-cp313-macosx_11_0_arm64
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: spyrrow
3
- Version: 0.2.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
- License: MIT
9
- Requires-Python: >=3.10
10
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
11
-
12
- # Spyrrow
13
-
14
- Python wrapper on the Rust project [`sparrow`](https://github.com/JeroenGar/sparrow)
15
-
16
- ## Examples
17
- ```python
18
- import spyrrow
19
-
20
- rectangle1 = spyrrow.Item([(0,0),(1,0),(1,1),(0,1),(0,0)], demand=4, allowed_orientations=[0])
21
- triangle1 = spyrrow.Item([(0,0),(1,0),(1,1),(0,0)], demand=6, allowed_orientations=[0,90,180,-90])
22
-
23
- instance = spyrrow.StripPackingInstance("test", height=2.001, items=[rectangle1,triangle1])
24
- sol:spyrrow.StripPackingSolution = instance.solve(30)
25
- print(sol.width)
26
- print(sol.density)
27
- print("\n")
28
- for pi in sol.placed_items:
29
- print(pi.id)
30
- print(pi.rotation)
31
- print(pi.translation)
32
- print("\n")
33
- ```
34
-
35
- ## Informations
36
-
37
- The algorithmn is insensitive to rotation angles and shapes complexity (to a certain extend)
38
-
39
- # TODOS
40
-
41
- ## Pay attention to that
42
-
43
-
44
- use test-profile for local developpment
45
-
46
- investiguate the compile options, nightly and SIMD and PyPa target architectures
47
-
48
- - add presets for parameters as enums
49
-
50
- ## Mixed project Python/Rust
51
- possibility to add conversion from shapely in a shapely variant
52
- investiguate the possibility of maturin to handle extras
53
-
54
-
@@ -1,8 +0,0 @@
1
- spyrrow-0.2.0.dist-info/METADATA,sha256=p9D_QSmvABrTUdR-gSzH7Jy4Q3KDGeclq7SlgSNpnZo,1467
2
- spyrrow-0.2.0.dist-info/WHEEL,sha256=E1n5fBV87GjwiE9CayevgONfw5z1JsKZqIr2VxzumWg,104
3
- spyrrow-0.2.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
4
- spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
5
- spyrrow/__init__.pyi,sha256=9cCpUUc08P05BLw-ZZan96eJM9WaOdRDld42lWLHOTE,756
6
- spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- spyrrow/spyrrow.cpython-313-darwin.so,sha256=ayEfLY1q8eVVYaF6a0o37WwWkN5Cz2JAiL4w7j8Dlic,1344992
8
- spyrrow-0.2.0.dist-info/RECORD,,