skillfed

prtpy

Number partitioning in Python

prtpy v0.8.3 391.7K downloads/30d#7,013 on PyPI57
Permissive license MIT AGING released

What it is and what it does

prtpy provides a collection of algorithms for partitioning numbers into bins and packing items into fixed-capacity bins. It supports both exact methods (via integer linear programming through the mip library) and approximate greedy algorithms, allowing you to choose between solution quality and computation speed. The package wraps numpy and scipy for numerical operations and can optionally use GUROBI for faster ILP solving.

You supply items (with numeric values), a target number of bins or bin capacity, and an optimization objective (e.g., maximize the smallest bin sum, minimize the largest bin sum). The library returns the assignment of items to bins. It's designed for load-balancing, resource allocation, and scheduling problems where you need to distribute work or items fairly or efficiently across a fixed number of containers.

Use it for:

  • Distribute computational tasks across multiple processors to minimize makespan (longest task completion time).
  • Pack items into shipping containers to minimize the number of containers or maximize container utilization.
  • Allocate workload across servers to balance CPU or memory usage and avoid overload.
  • Partition a dataset into balanced subsets for parallel processing or cross-validation in machine learning.
  • Solve fair division problems where items must be split among parties with minimal imbalance.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements multiway number partitioning and bin packing algorithms with support for exact and approximate methods, multiple input formats, and configurable optimization objectives.

Yes, if you need a flexible, permissively licensed partitioning or bin-packing solver. The low install friction and zero known vulnerabilities are strengths. However, the aging maintenance status (last release over a year ago, Pre-Alpha classifier) and lack of recent activity suggest treating it as stable but not actively developed—suitable for production use if the algorithm suite meets your needs, but do not expect rapid bug fixes or new features.

Install

prtpy on PyPI

pip

pip install prtpy

uv

uv add prtpy

poetry

poetry add prtpy

Installing prtpy

Before you install

Low friction installation with three core runtime dependencies (numpy, scipy, mip). Package is aging—last release was 2024-05-15, over a year ago—but the repository remains active with recent commits and no archived status.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations beyond attribution.

Quickstart

pip install prtpy

import prtpy
prtpy.partition(algorithm=prtpy.partitioning.greedy, numbins=2, items=[1,2,3,4,5])

Requires Python 3.8 or later. Optional: GUROBI solver can accelerate ILP-based algorithms via python-mip.

Verify before relying

  • Whether the package's Pre-Alpha status reflects incomplete feature coverage or simply conservative versioning.
  • Current performance characteristics and scalability limits for large item sets or bin counts.
  • Whether the 821 days since last release indicates maintenance abandonment or stable maturity.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, scipy, mip
Maintenance aging — 821 days since the last release
Last repo commit
First released
Downloads 391,716/month — #7,013 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prtpy-0.8.3-py3-none-any.whl

Keywords: optimization, partition

Development Status :: 2 - Pre-Alpha

Tags

number partitioning algorithmsbin packing pythonmultiway partitioningload balancing optimizationitem distribution algorithmsgreedy partitioningbin covering algorithms
optimizationload-balancingcombinatorial-algorithms

More Mathematics packages