polarobi
Build gurobipy models from polars frames. Columns go from Arrow memory into the Gurobi C API in one call per variable or constraint family, while the model stays fully usable through gurobipy.
import polarobi # registers df.grb
x = dist.grb.add_vars(model, by=("so_p7", "vendor_code", "ex_go_date"), vtype="B", obj="cost", name="x_dist")
caps = x.grb.add_constrs(model, vendor_cap, by=("vendor_code", "ex_go_date"), sense="<=", rhs="max_quantity", coef="quantity")
model.optimize()
solution = x.grb.get(model, "X").filter(pl.col("X") > 0)
How it works
Model._cmodelholds theGRBmodel*. The native module binds to the Gurobi library that gurobipy already loaded (never a second copy) and checks that both report the same version.- Numeric columns are passed without copying (one concatenation if a column has several chunks). Names are copied, since C needs NUL-terminated strings.
- New columns and rows are registered with gurobipy as
gp.Var(cmodel, i)/gp.Constr(cmodel, i)handles inModel._internal_vars/Model._constrs. That is what keepsgetVars,getVarByName, mixed expressions,remove,copyand friends working. Creating the handles costs about 2 µs each, the same as inaddVars. - Constraint and term order follow the input frames, so equal inputs build models with equal
Fingerprints.
This relies on private gurobipy attributes (_cmodel, _internal_vars, _livevars, _constrs,
_liveconstrs, _has_pending_deletions). Pin gurobipy to a minor version and keep
tests/test_compat.py in CI.
Layout
src/: the Rust extension (pyo3,pyo3-arrow), built as modulepolarobi._native.python/polarobi/: the Python package with thedf.grbnamespace.
Build with uv sync (maturin backend, see pyproject.toml); run the tests with uv run pytest.
Metadata
Release files for polarobi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| polarobi-0.1.0.tar.gz | 66.0 kB | Without provenance | Details for polarobi-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polarobi-0.1.0-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details for polarobi-0.1.0-cp314-cp314-win_amd64.whl |
Total release size: 679.7 kB
Release files / polarobi-0.1.0.tar.gz
| Download URL | polarobi-0.1.0.tar.gz |
|---|---|
| Size | 66.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8c08f014f22ad1d78fc935259435028350c1788aeec358e3543a2c5ddced5eb
|
|
BLAKE2b-256 checksum How to use checksums |
6f2f31447230d0718ac5c13b5edc54f38fe7c857451afe52f91b695628f93fb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / polarobi-0.1.0-cp314-cp314-win_amd64.whl
| Download URL | polarobi-0.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 613.7 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9cdd21509dbde3a198dcb66048e745ea9c91c4d05359c6fd50ef969f4c201ae8
|
|
BLAKE2b-256 checksum How to use checksums |
a57fb829a14f4e092c17833eb9702b9f515d8aa8700d6e629df0fa784b67cbe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for polarobi 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.