{"id":5386,"library":"py3dbp","title":"3D Bin Packing","description":"py3dbp is a Python library for solving the 3D Bin Packing problem, an optimization challenge focused on fitting items of various sizes into a finite number of bins. The current stable version is 1.1.2, released in July 2020. The library appears to be in maintenance mode with infrequent updates.","status":"maintenance","version":"1.1.2","language":"en","source_language":"en","source_url":"https://github.com/enzoruiz/3dbinpacking","tags":["3d bin packing","optimization","logistics","packing","spatial"],"install":[{"cmd":"pip install py3dbp","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Packer","correct":"from py3dbp import Packer"},{"symbol":"Bin","correct":"from py3dbp import Bin"},{"symbol":"Item","correct":"from py3dbp import Item"},{"note":"Optional: Painter is used for visualization, often found in examples from forks.","symbol":"Painter","correct":"from py3dbp import Packer, Bin, Item, Painter"}],"quickstart":{"code":"from py3dbp import Packer, Bin, Item\n\n# Initialize packer\npacker = Packer()\n\n# Add bins\npacker.add_bin(Bin('large-box', 12.0, 12.0, 5.5, 70.0))\npacker.add_bin(Bin('medium-box', 11.0, 8.5, 5.5, 70.0))\n\n# Add items\npacker.add_item(Item('item-1', 5.0, 3.0, 2.0, 5.0))\npacker.add_item(Item('item-2', 4.0, 4.0, 3.0, 3.0))\npacker.add_item(Item('item-3', 6.0, 2.0, 1.0, 2.0))\n\n# Pack items into bins\n# Default parameters: bigger_first=False, distribute_items=False, number_of_decimals=3\npacker.pack(bigger_first=True, distribute_items=True)\n\n# Print results\nfor bin_obj in packer.bins:\n    print(f\"\\nBin: {bin_obj.name}, Volume: {bin_obj.get_total_volume()} cubic units, Weight: {bin_obj.get_total_weight()} kg\")\n    print(\"  Fitted items:\")\n    for item in bin_obj.items:\n        print(f\"    - {item.name} (WHL: {item.width}x{item.height}x{item.depth}, Weight: {item.weight}kg)\")\n    print(f\"  Unfitted items: {len(bin_obj.unfitted_items)}\")\n    for item in bin_obj.unfitted_items:\n        print(f\"    - {item.name} (WHL: {item.width}x{item.height}x{item.depth}, Weight: {item.weight}kg)\")","lang":"python","description":"This quickstart demonstrates how to define bins and items, add them to a Packer instance, and then execute the packing algorithm. It also shows how to retrieve the fitted and unfitted items per bin. The `pack` method parameters `bigger_first` and `distribute_items` are highlighted due to their importance in packing strategy."},"warnings":[{"fix":"Review the desired packing logic and explicitly set `distribute_items=True` or `distribute_items=False` in `packer.pack()` to match the expected behavior for your use case. Also, be aware that the default for `bigger_first` has been observed to vary in some forks/examples (sometimes `True`, sometimes `False`). Always explicitly set `bigger_first`.","message":"The `distribute_items` parameter behavior changed significantly between version 0.x and 1.x. In 0.x, it tried to put all items in the first bin that could fit at least one. In 1.x, when `distribute_items=True`, it distributes all items across all bins; when `distribute_items=False`, each bin attempts to pack all items independently.","severity":"breaking","affected_versions":"0.x to 1.x"},{"fix":"Always explicitly define the `bigger_first`, `distribute_items`, and `number_of_decimals` parameters when calling `packer.pack()` to ensure consistent and predictable results based on your requirements.","message":"The `pack()` method's default parameters (`bigger_first=False`, `distribute_items=False`, `number_of_decimals=3`) may not always be optimal or align with intuitive expectations. Different forks or examples of the library might implicitly suggest different defaults for these parameters.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider reviewing existing issues or pull requests on the GitHub repository for potential workarounds or community-contributed improvements. Be prepared for self-support or to adapt the library if specific new features or critical bug fixes are required.","message":"The library's last release was in July 2020. While functional, it indicates that active development might be minimal, and community support or bug fixes may be limited.","severity":"gotcha","affected_versions":"1.1.2 and earlier"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}