spyrrow 0.1.0__tar.gz → 0.3.0__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.

Potentially problematic release.


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

@@ -1,7 +1,7 @@
1
1
  # This file is autogenerated by maturin v1.8.3
2
2
  # To update, run
3
3
  #
4
- # maturin generate-ci github
4
+ # maturin generate-ci github --pytest
5
5
  #
6
6
  name: CI
7
7
 
@@ -28,14 +28,14 @@ jobs:
28
28
  target: x86_64
29
29
  - runner: ubuntu-22.04
30
30
  target: x86
31
- # - runner: ubuntu-22.04
32
- # target: aarch64
33
- # - runner: ubuntu-22.04
34
- # target: armv7
35
- # - runner: ubuntu-22.04
36
- # target: s390x
37
- # - runner: ubuntu-22.04
38
- # target: ppc64le
31
+ - runner: ubuntu-22.04
32
+ target: aarch64
33
+ - runner: ubuntu-22.04
34
+ target: armv7
35
+ - runner: ubuntu-22.04
36
+ target: s390x
37
+ - runner: ubuntu-22.04
38
+ target: ppc64le
39
39
  steps:
40
40
  - uses: actions/checkout@v4
41
41
  - uses: actions/setup-python@v5
@@ -53,6 +53,31 @@ jobs:
53
53
  with:
54
54
  name: wheels-linux-${{ matrix.platform.target }}
55
55
  path: dist
56
+ - name: pytest
57
+ if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
58
+ shell: bash
59
+ run: |
60
+ set -e
61
+ python3 -m venv .venv
62
+ source .venv/bin/activate
63
+ pip install spyrrow --find-links dist --force-reinstall
64
+ pip install pytest
65
+ pytest
66
+ - name: pytest
67
+ if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
68
+ uses: uraimo/run-on-arch-action@v2
69
+ with:
70
+ arch: ${{ matrix.platform.target }}
71
+ distro: ubuntu22.04
72
+ githubToken: ${{ github.token }}
73
+ install: |
74
+ apt-get update
75
+ apt-get install -y --no-install-recommends python3 python3-pip
76
+ pip3 install -U pip pytest
77
+ run: |
78
+ set -e
79
+ pip3 install spyrrow --find-links dist --force-reinstall
80
+ pytest
56
81
 
57
82
  musllinux:
58
83
  runs-on: ${{ matrix.platform.runner }}
@@ -84,6 +109,36 @@ jobs:
84
109
  with:
85
110
  name: wheels-musllinux-${{ matrix.platform.target }}
86
111
  path: dist
112
+ - name: pytest
113
+ if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
114
+ uses: addnab/docker-run-action@v3
115
+ with:
116
+ image: alpine:latest
117
+ options: -v ${{ github.workspace }}:/io -w /io
118
+ run: |
119
+ set -e
120
+ apk add py3-pip py3-virtualenv
121
+ python3 -m virtualenv .venv
122
+ source .venv/bin/activate
123
+ pip install spyrrow --no-index --find-links dist --force-reinstall
124
+ pip install pytest
125
+ pytest
126
+ - name: pytest
127
+ if: ${{ !startsWith(matrix.platform.target, 'x86') }}
128
+ uses: uraimo/run-on-arch-action@v2
129
+ with:
130
+ arch: ${{ matrix.platform.target }}
131
+ distro: alpine_latest
132
+ githubToken: ${{ github.token }}
133
+ install: |
134
+ apk add py3-virtualenv
135
+ run: |
136
+ set -e
137
+ python3 -m virtualenv .venv
138
+ source .venv/bin/activate
139
+ pip install pytest
140
+ pip install spyrrow --find-links dist --force-reinstall
141
+ pytest
87
142
 
88
143
  windows:
89
144
  runs-on: ${{ matrix.platform.runner }}
@@ -111,6 +166,16 @@ jobs:
111
166
  with:
112
167
  name: wheels-windows-${{ matrix.platform.target }}
113
168
  path: dist
169
+ - name: pytest
170
+ if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
171
+ shell: bash
172
+ run: |
173
+ set -e
174
+ python3 -m venv .venv
175
+ source .venv/Scripts/activate
176
+ pip install spyrrow --find-links dist --force-reinstall
177
+ pip install pytest
178
+ pytest
114
179
 
115
180
  macos:
116
181
  runs-on: ${{ matrix.platform.runner }}
@@ -137,6 +202,14 @@ jobs:
137
202
  with:
138
203
  name: wheels-macos-${{ matrix.platform.target }}
139
204
  path: dist
205
+ - name: pytest
206
+ run: |
207
+ set -e
208
+ python3 -m venv .venv
209
+ source .venv/bin/activate
210
+ pip install spyrrow --find-links dist --force-reinstall
211
+ pip install pytest
212
+ pytest
140
213
 
141
214
  sdist:
142
215
  runs-on: ubuntu-latest
@@ -179,28 +252,28 @@ jobs:
179
252
  command: upload
180
253
  args: --non-interactive --skip-existing wheels-*/*
181
254
 
182
- testpypi-release:
183
- name: Release on Test PyPi to ensure the CI/CD validity
184
- runs-on: ubuntu-latest
185
- needs: [linux, musllinux, windows, macos, sdist]
186
- environment:
187
- name: testpypi
188
- url: https://test.pypi.org/p/spyrrow
189
- permissions:
190
- # Use to sign the release artifacts
191
- id-token: write
192
- # Used to upload release artifacts
193
- contents: write
194
- # Used to generate artifact attestation
195
- attestations: write
196
- steps:
197
- - uses: actions/download-artifact@v4
198
- - name: Generate artifact attestation
199
- uses: actions/attest-build-provenance@v2
200
- with:
201
- subject-path: 'wheels-*/*'
202
- - name: Publish to TestPyPI
203
- uses: PyO3/maturin-action@v1
204
- with:
205
- command: upload
206
- args: --non-interactive --skip-existing wheels-*/* --repository-url=https://test.pypi.org/legacy/ --verbose
255
+ # testpypi-release:
256
+ # name: Release on Test PyPi to ensure the CI/CD validity
257
+ # runs-on: ubuntu-latest
258
+ # needs: [linux, musllinux, windows, macos, sdist]
259
+ # environment:
260
+ # name: testpypi
261
+ # url: https://test.pypi.org/p/spyrrow
262
+ # permissions:
263
+ # # Use to sign the release artifacts
264
+ # id-token: write
265
+ # # Used to upload release artifacts
266
+ # contents: write
267
+ # # Used to generate artifact attestation
268
+ # attestations: write
269
+ # steps:
270
+ # - uses: actions/download-artifact@v4
271
+ # - name: Generate artifact attestation
272
+ # uses: actions/attest-build-provenance@v2
273
+ # with:
274
+ # subject-path: 'wheels-*/*'
275
+ # - name: Publish to TestPyPI
276
+ # uses: PyO3/maturin-action@v1
277
+ # with:
278
+ # command: upload
279
+ # args: --non-interactive --skip-existing wheels-*/* --repository-url=https://test.pypi.org/legacy/ --verbose
@@ -0,0 +1,18 @@
1
+ # https://docs.readthedocs.io/en/stable/config-file/v2.html#supported-settings
2
+
3
+ version: 2
4
+
5
+ sphinx:
6
+ builder: html
7
+ configuration: docs/conf.py
8
+
9
+ build:
10
+ os: "ubuntu-22.04"
11
+ tools:
12
+ python: "3.11"
13
+ rust: "1.86"
14
+
15
+ python:
16
+ install:
17
+ - method: pip
18
+ path: .
@@ -53,13 +53,10 @@ dependencies = [
53
53
  ]
54
54
 
55
55
  [[package]]
56
- name = "approx"
57
- version = "0.5.1"
56
+ name = "anyhow"
57
+ version = "1.0.98"
58
58
  source = "registry+https://github.com/rust-lang/crates.io-index"
59
- checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
60
- dependencies = [
61
- "num-traits",
62
- ]
59
+ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
63
60
 
64
61
  [[package]]
65
62
  name = "autocfg"
@@ -73,15 +70,6 @@ version = "2.9.0"
73
70
  source = "registry+https://github.com/rust-lang/crates.io-index"
74
71
  checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
75
72
 
76
- [[package]]
77
- name = "cc"
78
- version = "1.2.19"
79
- source = "registry+https://github.com/rust-lang/crates.io-index"
80
- checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362"
81
- dependencies = [
82
- "shlex",
83
- ]
84
-
85
73
  [[package]]
86
74
  name = "cfg-if"
87
75
  version = "1.0.0"
@@ -134,15 +122,6 @@ version = "0.7.4"
134
122
  source = "registry+https://github.com/rust-lang/crates.io-index"
135
123
  checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
136
124
 
137
- [[package]]
138
- name = "clipper-sys"
139
- version = "0.8.0"
140
- source = "registry+https://github.com/rust-lang/crates.io-index"
141
- checksum = "b5141c32419064aef7322f754b92fd4ea53c360c1ad984ec38b58af533eba3ac"
142
- dependencies = [
143
- "cc",
144
- ]
145
-
146
125
  [[package]]
147
126
  name = "colorchoice"
148
127
  version = "1.0.3"
@@ -184,6 +163,15 @@ dependencies = [
184
163
  "windows-sys",
185
164
  ]
186
165
 
166
+ [[package]]
167
+ name = "document-features"
168
+ version = "0.2.11"
169
+ source = "registry+https://github.com/rust-lang/crates.io-index"
170
+ checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
171
+ dependencies = [
172
+ "litrs",
173
+ ]
174
+
187
175
  [[package]]
188
176
  name = "dtoa"
189
177
  version = "1.0.10"
@@ -214,39 +202,6 @@ dependencies = [
214
202
  "num-traits",
215
203
  ]
216
204
 
217
- [[package]]
218
- name = "geo-clipper"
219
- version = "0.9.0"
220
- source = "registry+https://github.com/rust-lang/crates.io-index"
221
- checksum = "2370335cc0c40c7bc1e5b0ead27bdbb2132d54cfbb96248a4bdd65db1a6873aa"
222
- dependencies = [
223
- "clipper-sys",
224
- "geo-types",
225
- ]
226
-
227
- [[package]]
228
- name = "geo-offset"
229
- version = "0.4.0"
230
- source = "registry+https://github.com/rust-lang/crates.io-index"
231
- checksum = "d74cc1ae801176d4cfee3f4be7dd8758aa5e3c6155bf7d1fd8b5db3546eb7fe4"
232
- dependencies = [
233
- "geo-clipper",
234
- "geo-types",
235
- "itertools",
236
- "num-traits",
237
- ]
238
-
239
- [[package]]
240
- name = "geo-types"
241
- version = "0.7.16"
242
- source = "registry+https://github.com/rust-lang/crates.io-index"
243
- checksum = "62ddb1950450d67efee2bbc5e429c68d052a822de3aad010d28b351fbb705224"
244
- dependencies = [
245
- "approx",
246
- "num-traits",
247
- "serde",
248
- ]
249
-
250
205
  [[package]]
251
206
  name = "getrandom"
252
207
  version = "0.3.2"
@@ -300,21 +255,21 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
300
255
 
301
256
  [[package]]
302
257
  name = "jagua-rs"
303
- version = "0.4.0"
304
- source = "git+https://github.com/JeroenGar/jagua-rs.git?rev=eb78f5e255890f95bc900dd0b7fed7f5d9f7a5cd#eb78f5e255890f95bc900dd0b7fed7f5d9f7a5cd"
258
+ version = "0.5.1"
259
+ source = "git+https://github.com/JeroenGar/jagua-rs.git?rev=06152d8654d8b9b0652c14ccd1f5d693b703b5de#06152d8654d8b9b0652c14ccd1f5d693b703b5de"
305
260
  dependencies = [
261
+ "anyhow",
262
+ "document-features",
306
263
  "float-cmp",
307
- "geo-offset",
308
- "geo-types",
309
264
  "itertools",
310
265
  "log",
311
266
  "ndarray",
312
267
  "ordered-float",
313
- "rand",
314
268
  "rand_distr",
315
269
  "rayon",
316
270
  "serde",
317
271
  "slotmap",
272
+ "svg",
318
273
  "tribool",
319
274
  ]
320
275
 
@@ -371,6 +326,12 @@ version = "0.2.11"
371
326
  source = "registry+https://github.com/rust-lang/crates.io-index"
372
327
  checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
373
328
 
329
+ [[package]]
330
+ name = "litrs"
331
+ version = "0.4.1"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
334
+
374
335
  [[package]]
375
336
  name = "log"
376
337
  version = "0.4.27"
@@ -707,12 +668,6 @@ dependencies = [
707
668
  "serde",
708
669
  ]
709
670
 
710
- [[package]]
711
- name = "shlex"
712
- version = "1.3.0"
713
- source = "registry+https://github.com/rust-lang/crates.io-index"
714
- checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
715
-
716
671
  [[package]]
717
672
  name = "slotmap"
718
673
  version = "1.0.7"
@@ -725,8 +680,9 @@ dependencies = [
725
680
  [[package]]
726
681
  name = "sparrow"
727
682
  version = "0.1.0"
728
- source = "git+https://github.com/JeroenGar/sparrow.git?rev=74395dac365c6621bc5029483eded58ba27ec9da#74395dac365c6621bc5029483eded58ba27ec9da"
683
+ source = "git+https://github.com/JeroenGar/sparrow.git?rev=cb456fe41443c6c3153141aa8e945fedba78e60b#cb456fe41443c6c3153141aa8e945fedba78e60b"
729
684
  dependencies = [
685
+ "anyhow",
730
686
  "clap",
731
687
  "ctrlc",
732
688
  "fern",
@@ -737,7 +693,6 @@ dependencies = [
737
693
  "log",
738
694
  "num_cpus",
739
695
  "numfmt",
740
- "once_cell",
741
696
  "ordered-float",
742
697
  "rand",
743
698
  "rand_distr",
@@ -752,11 +707,13 @@ dependencies = [
752
707
 
753
708
  [[package]]
754
709
  name = "spyrrow"
755
- version = "0.1.0"
710
+ version = "0.3.0"
756
711
  dependencies = [
757
712
  "jagua-rs",
758
713
  "pyo3",
759
714
  "rand",
715
+ "serde",
716
+ "serde_json",
760
717
  "sparrow",
761
718
  ]
762
719
 
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "spyrrow"
3
- version = "0.1.0"
4
- edition = "2021"
3
+ version = "0.3.0"
4
+ edition = "2024"
5
5
  license = "MIT"
6
6
 
7
7
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -10,9 +10,9 @@ name = "spyrrow"
10
10
  crate-type = ["cdylib"]
11
11
 
12
12
  [dependencies]
13
- jagua-rs = { git = "https://github.com/JeroenGar/jagua-rs.git", rev="eb78f5e255890f95bc900dd0b7fed7f5d9f7a5cd"}
13
+ jagua-rs = { git = "https://github.com/JeroenGar/jagua-rs.git", rev="06152d8654d8b9b0652c14ccd1f5d693b703b5de", features = ["spp"], default-features = false}
14
14
  pyo3 = "0.24.0"
15
15
  rand = { version = "0.9.0", features = ["small_rng"] }
16
- sparrow = { git = "https://github.com/JeroenGar/sparrow.git",rev="74395dac365c6621bc5029483eded58ba27ec9da" }
17
-
18
-
16
+ serde = {version = "1.0.219", features = ["derive"]}
17
+ serde_json = "1.0.140"
18
+ sparrow = { git = "https://github.com/JeroenGar/sparrow.git",rev="cb456fe41443c6c3153141aa8e945fedba78e60b",features = ["only_final_svg"], default-features = false}
spyrrow-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: spyrrow
3
+ Version: 0.3.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,53 @@
1
+ # Spyrrow
2
+
3
+ `spyrrow` is a Python wrapper on the Rust project [`sparrow`](https://github.com/JeroenGar/sparrow).
4
+ It enables to solve 2D [Strip packing problems](https://en.wikipedia.org/wiki/Strip_packing_problem).
5
+
6
+ The documentation is hosted [here](https://spyrrow.readthedocs.io/).
7
+
8
+ ## Installation
9
+
10
+ Spyrrow is hosted on [PyPI](https://pypi.org/project/spyrrow/).
11
+
12
+ You can install with the package manager of your choice, using the PyPI package index.
13
+
14
+ For example, with `pip`, the default Python package:
15
+ ```bash
16
+ pip install spyrrow
17
+ ```
18
+
19
+ ## Examples
20
+ ```python
21
+ import spyrrow
22
+
23
+ rectangle1 = spyrrow.Item(
24
+ 0, [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], demand=4, allowed_orientations=[0]
25
+ )
26
+ triangle1 = spyrrow.Item(
27
+ 1,
28
+ [(0, 0), (1, 0), (1, 1), (0, 0)],
29
+ demand=6,
30
+ allowed_orientations=[0, 90, 180, -90],
31
+ )
32
+
33
+ instance = spyrrow.StripPackingInstance("test", strip_height=2.001, items=[rectangle1,triangle1])
34
+ sol:spyrrow.StripPackingSolution = instance.solve(30)
35
+ print(sol.width)
36
+ print(sol.density)
37
+ print("\n")
38
+ for pi in sol.placed_items:
39
+ print(pi.id)
40
+ print(pi.rotation)
41
+ print(pi.translation)
42
+ print("\n")
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ Spyrrow is open to contributions.
48
+ The first target should be to reach Python open sources packages standards and practices.
49
+ Second, a easier integration with the package `shapely` is envsionned.
50
+
51
+ Please use GitHub issues to request features.
52
+ They will be considered relative to what is already implemented in the parent library `sparrow`.
53
+ If necessary, they can be forwarded to it.
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,12 @@
1
+ API
2
+ ===
3
+
4
+ Public API of `spyrrow`
5
+
6
+ .. autoclass:: spyrrow::Item
7
+
8
+ .. autoclass:: spyrrow::StripPackingInstance
9
+
10
+ .. autoclass:: spyrrow::StripPackingSolution
11
+
12
+ .. autoclass:: spyrrow::PlacedItem
@@ -0,0 +1,32 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # -- Project information -----------------------------------------------------
7
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
+
9
+ project = 'spyrrow'
10
+ copyright = '2025, Paul Durand-Lupinski'
11
+ author = 'Paul Durand-Lupinski'
12
+ release = '0.3.0'
13
+
14
+ # -- General configuration ---------------------------------------------------
15
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16
+
17
+ extensions = [
18
+ 'sphinx.ext.napoleon',
19
+ 'sphinx.ext.autodoc'
20
+ ]
21
+
22
+ templates_path = ['_templates']
23
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
24
+
25
+ # Napoleon settings
26
+ napoleon_google_docstring = True
27
+
28
+ # -- Options for HTML output -------------------------------------------------
29
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
30
+
31
+ html_theme = 'alabaster'
32
+ html_static_path = ['_static']
@@ -0,0 +1,57 @@
1
+ .. spyrrow documentation master file, created by
2
+ sphinx-quickstart on Mon May 19 14:10:17 2025.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ spyrrow documentation
7
+ =====================
8
+
9
+ `spyrrow` is a Python wrapper on the Rust project `sparrow <https://github.com/JeroenGar/sparrow>`_.
10
+ It enables to solve 2D `Strip packing problems <https://en.wikipedia.org/wiki/Strip_packing_problem>`_.
11
+
12
+ .. toctree::
13
+ :maxdepth: 2
14
+ :caption: Contents:
15
+
16
+ api
17
+
18
+ Installation
19
+ ============
20
+
21
+ Spyrrow is hosted on `PyPI <https://pypi.org/project/spyrrow/>`_.
22
+
23
+ You can install with the package manager of your choice, using the PyPI package index.
24
+
25
+ For example, with `pip`, the default Python package:
26
+
27
+ .. code-block:: bash
28
+
29
+ pip install spyrrow
30
+
31
+ Examples
32
+ ========
33
+
34
+ .. code-block:: python
35
+
36
+ import spyrrow
37
+
38
+ rectangle1 = spyrrow.Item(
39
+ 0, [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], demand=4, allowed_orientations=[0]
40
+ )
41
+ triangle1 = spyrrow.Item(
42
+ 1,
43
+ [(0, 0), (1, 0), (1, 1), (0, 0)],
44
+ demand=6,
45
+ allowed_orientations=[0, 90, 180, -90],
46
+ )
47
+
48
+ instance = spyrrow.StripPackingInstance("test", strip_height=2.001, items=[rectangle1,triangle1])
49
+ sol:spyrrow.StripPackingSolution = instance.solve(30)
50
+ print(sol.width)
51
+ print(sol.density)
52
+ print("\n")
53
+ for pi in sol.placed_items:
54
+ print(pi.id)
55
+ print(pi.rotation)
56
+ print(pi.translation)
57
+ print("\n")