WWU
Which Way Up? — Pack more boxes into less space.
WWU finds the optimal orientation for storing a box in a given storage space, maximising how many fit. Just pass in your box size and storage dimensions, and WWU tells you which way to turn it.
No dependencies. No config. One function call.
Contents
Permutation Index
The returned index (0–5) maps to orientation as follows for a box with dimensions (H, W, D):
| Index | Orientation |
|---|---|
| 0 | (H, W, D) |
| 1 | (H, D, W) |
| 2 | (W, H, D) |
| 3 | (W, D, H) |
| 4 | (D, H, W) |
| 5 | (D, W, H) |
Examples
from wwu import Box
b = Box(10, 10, 20) # Create a box with 10 x 10 x 20 dimensions.
b.wwu(10, 10, 20) # Find the optimal permutation in storage of 10 x 10 x 20
# >>> 0
b.wwu(20, 10, 10) # Different storage shape picks a different orientation
# >>> 4
For more detail, use best_orientation() which returns the index, the dimension
ordering, and how many boxes fit:
from wwu import Box
b = Box(10, 10, 20)
result = b.best_orientation(40, 20, 20)
print(result.perm_index) # Orientation index
print(result.dimensions) # The dimension ordering used
print(result.box_count) # Number of boxes that fit
Dimensions are validated — zero, negative, or non-numeric values raise an error:
Box(-1, 10, 20) # ValueError: Box height must be positive
b.wwu(10, 10, "ten") # TypeError: Storage depth must be a number
How It Works
For each of the 6 permutations of the box's (height, width, depth), WWU computes
how many boxes fit along each storage axis independently (floor(storage_axis / box_axis))
and multiplies them together to get a total box count for that orientation. It returns
whichever permutation yields the highest count.
Limitations
WWU answers "how many identical boxes fit, axis-aligned, in a grid?" — it is not a general bin-packing or mixed-carton solver. In particular:
- All boxes are assumed to be the same size (one
Boxper call). - Boxes are placed on a uniform grid along each axis; it does not try irregular or interlocking arrangements that could fit more boxes into leftover space.
- Rotations are limited to the 6 axis-aligned permutations of height/width/depth — no diagonal or off-axis placement.
Installation
pip install wwu
Requirements
Python 3.9+. No runtime dependencies.
Contributing
git clone https://github.com/Um9i/wwu.git
cd wwu
pip install -e ".[test,lint]"
pytest # run tests
ruff check . # lint
Metadata
Release files for wwu 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wwu-0.0.4.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wwu-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / wwu-0.0.4.tar.gz
| Download URL | wwu-0.0.4.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6acf280f68ecf5df5d0b06cf1db2971bd9bdc287e323f593d7129c02e5754418
|
|
BLAKE2b-256 checksum How to use checksums |
7a8ef5bf83326e4f83888bc6d366779cc15fa9bda276d17b5acf7edb52bffb2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency logRelease files / wwu-0.0.4-py3-none-any.whl
| Download URL | wwu-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
093439a7b5d5b6caafac9d045534888407d677090b2383cd81d0a28e17e3ab06
|
|
BLAKE2b-256 checksum How to use checksums |
1a122816ff05eb3cfdc419ba19f59bb3c8c86273296ef6de715d4207c403eb97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency log