Skip to main content

Python client for the Quicopt service — author models, emit the Quicopt wire IR.

Project description

quicopt

The Python client for the Quicopt optimization service. Author a model in a Python modeling front-end (Pyomo, or OR-Tools MathOpt), convert it to Quicopt's wire IR, and emit the versioned, language-neutral bytes the service consumes.

Install

pip install quicopt              # core (ir + wire) — standard library only
pip install "quicopt[pyomo]"     # + the Pyomo front-end
pip install "quicopt[mathopt]"   # + the OR-Tools MathOpt front-end

From source (contributors), an editable install into a virtual environment:

python3 -m venv .venv && . .venv/bin/activate
pip install -e '.[pyomo,mathopt]'

Use

import pyomo.environ as pyo
from quicopt import Client

m = pyo.ConcreteModel()
m.x = pyo.Var(bounds=(0.1, 10))
m.obj = pyo.Objective(expr=m.x**2 + 1.0 / m.x, sense=pyo.minimize)

client = Client("https://quicopt.example")   # your service endpoint
result = client.solve(m)                      # solve the model — the import to the
                                              # wire IR happens inside
print(result.status, result.objective, result.solution)
print(result.display)                         # the service's ready-to-print summary

solve takes the model directly (Pyomo, or an OR-Tools MathOpt model) and imports it to the wire IR internally. The first keyless call mints an API key (client.api_key); reuse it on later calls (Client(url, api_key=…)). For a long solve, client.submit(m) returns a job handle to poll — job.result().

If you need the wire bytes yourself (to inspect or send by another route), the front-end importers and encoder are still public:

from quicopt import encode
from quicopt.pyomo import import_model

payload = encode(import_model(m))   # Pyomo model → Program → versioned wire bytes

Layout

quicopt/ir.py      the Program IR data model
quicopt/wire.py    Program → versioned wire bytes (a stdlib-only encoder)
quicopt/pyomo.py   Pyomo model → Program (a front-end)
quicopt/mathopt.py OR-Tools MathOpt model → Program (a front-end)
quicopt/client.py  POST the wire bytes to the service, read the result (HTTP, stdlib)

The IR and wire format are the client's contract with the service; wire.py encodes that schema exactly. Each front-end is an independent module beside pyomo.py (mathopt.py for OR-Tools authors; further modeling libraries slot in the same way) and pulls in only its own optional extra.

Test

The encoder is checked against committed golden byte vectors, with no dependencies:

python3 tests/test_wire_golden.py        # or: pytest tests/

Status

  • ir + wire — stable; the encoder is byte-exact against what the service decodes.
  • pyomo importer — affine / quadratic / nonlinear (+ - * / ^ sin cos exp log sqrt abs), variable bounds (incl. unbounded) + integrality, == / <= / >= / ranged constraints, min / max.
  • mathopt importer — OR-Tools MathOpt ModelProto: linear / quadratic objective, linear constraints (incl. ranged and one-sided), variable bounds (incl. unbounded) + integrality, min / max.
  • transport (HTTP)Client.solve / Client.submit over /v1/solve and /v1/jobs: wire bytes up, result JSON (status / objective / solution / framed display) back; API-key minting on the first call, optional gzip. Standard library only.

License

Apache License 2.0 — see LICENSE. (c) 2026 Tim Bode, PGI-12, Forschungszentrum Jülich.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quicopt-0.1.0.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quicopt-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file quicopt-0.1.0.tar.gz.

File metadata

  • Download URL: quicopt-0.1.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quicopt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 69efe4c7067041573665323092b4bf3d1d9678bf65506536adbe151655444aec
MD5 c93c459799827d177b807e4f3cebddaa
BLAKE2b-256 84281461300cfc71b0753acb7c7a21975c9bc227e52af1905205ea285dd5b4e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for quicopt-0.1.0.tar.gz:

Publisher: release.yml on timbode/quicopt-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quicopt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: quicopt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quicopt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da08bd32f31d89c22cb5ebd0f4d34a34bc9faec656ccc853087e22b8a50caf7e
MD5 8899147a4dbeba3ff613a4906a1db30c
BLAKE2b-256 937ccb894271589569146c4024305ee6fb5781f0e4813eff715780ead93bd976

See more details on using hashes here.

Provenance

The following attestation bundles were made for quicopt-0.1.0-py3-none-any.whl:

Publisher: release.yml on timbode/quicopt-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page