Skip to main content

Python bindings for Arco optimization library

Project description

Arco Python bindings

The Python package remains in bindings/python for path compatibility with existing build, release, and editable-install workflows. Its Rust crate is named arco-python and is the Python interaction surface; public Python imports stay under arco.

Python-facing solve orchestration is routed through the shared arco-ops facade where it overlaps with other interaction surfaces. The public Python API is unchanged.

Build and install locally with uv:

cd bindings/python
uv sync --group dev
uv run --with maturin maturin develop

To enable the IPOPT nonlinear backend, build with the ipopt feature (requires a system IPOPT install):

cd bindings/python
uv run --with maturin maturin develop --features ipopt

Run linting:

uv run ruff check .
uv run ty check .

Run Python example formulations from the repository root:

cd ../..
uv run examples/dense-lp/formulation.py --solve --json
uv run examples/sdom/formulation.py --solve --json

For interactive exploration of dense-lp (no extra script boilerplate):

cd ../..
uv run --with ipython --with-editable ./bindings/python ipython -i examples/dense-lp/formulation.py

Inside IPython, use model to inspect the formulation and call solve() when ready.

Running example problems

The examples/ tree contains standalone Python scripts that build models directly through the bindings, covering different problem classes:

  • LP — linear programs (default HiGHS backend).
  • MILP — mixed-integer linear programs (HiGHS).
  • NLP — nonlinear programs (requires bindings built with --features ipopt).
  • QP / QCP — (quadratically constrained) quadratic programs, solved through the appropriate backend for the problem class.

Run from bindings/python so the locally built extension is on the import path:

cd bindings/python

# LP — Multi-period DC-OPF (HiGHS)
uv run python ../../examples/multi-period-optimal-power-flow/dc-opf-24bus-wind-load-shedding/problem.py

# NLP — Multi-period AC-OPF (IPOPT)
uv run python ../../examples/multi-period-optimal-power-flow/ac-opf-24bus-wind-load-shedding/problem.py

Each script prints the solver status and final objective value alongside the reference value from the original formulation. Substitute the path to any other problem.py (or formulation.py) under examples/ to run a different model.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

arco-0.6.0-cp312-cp312-manylinux_2_38_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

File details

Details for the file arco-0.6.0-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for arco-0.6.0-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 b9a1c4998dbf818e4172c2664c6ec23709e31ce8c7f26d84a65d7fa7a9d7005b
MD5 bbc3a4f29a584b0c250c65b140bc0860
BLAKE2b-256 2d2a92b13813de0b6529dc5e9f3e60c80cf4bf33158c3379a2da7d4232c6f0a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for arco-0.6.0-cp312-cp312-manylinux_2_38_x86_64.whl:

Publisher: pypi-manual-release.yaml on NatLabRockies/arco

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