cpo3 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. cpo3-0.0.1/.github/workflows/checks.yml +91 -0
  2. cpo3-0.0.1/.github/workflows/release.yml +187 -0
  3. cpo3-0.0.1/.gitignore +31 -0
  4. cpo3-0.0.1/.python-version +2 -0
  5. cpo3-0.0.1/CHANGELOG.md +17 -0
  6. cpo3-0.0.1/Cargo.lock +1619 -0
  7. cpo3-0.0.1/Cargo.toml +59 -0
  8. cpo3-0.0.1/LICENSE +22 -0
  9. cpo3-0.0.1/PKG-INFO +272 -0
  10. cpo3-0.0.1/README.md +249 -0
  11. cpo3-0.0.1/benchmarks/README.md +33 -0
  12. cpo3-0.0.1/build.rs +34 -0
  13. cpo3-0.0.1/pyproject.toml +73 -0
  14. cpo3-0.0.1/python/cpo3/__init__.py +30 -0
  15. cpo3-0.0.1/python/cpo3/bindings.pyi +140 -0
  16. cpo3-0.0.1/python/cpo3/cones.py +102 -0
  17. cpo3-0.0.1/python/cpo3/io.py +16 -0
  18. cpo3-0.0.1/python/cpo3/problem.py +117 -0
  19. cpo3-0.0.1/python/cpo3/py.typed +1 -0
  20. cpo3-0.0.1/python/cpo3/settings.py +156 -0
  21. cpo3-0.0.1/python/cpo3/solver.py +53 -0
  22. cpo3-0.0.1/src/central_path/init.rs +664 -0
  23. cpo3-0.0.1/src/central_path/kkt_solver.rs +1012 -0
  24. cpo3-0.0.1/src/central_path/mehrotra.rs +765 -0
  25. cpo3-0.0.1/src/central_path/mod.rs +7 -0
  26. cpo3-0.0.1/src/central_path/resolvent.rs +399 -0
  27. cpo3-0.0.1/src/central_path/state.rs +274 -0
  28. cpo3-0.0.1/src/cone/geometry.rs +373 -0
  29. cpo3-0.0.1/src/cone/mod.rs +63 -0
  30. cpo3-0.0.1/src/equality.rs +207 -0
  31. cpo3-0.0.1/src/io/mod.rs +5 -0
  32. cpo3-0.0.1/src/io/mps.rs +701 -0
  33. cpo3-0.0.1/src/io/progress.rs +261 -0
  34. cpo3-0.0.1/src/lib.rs +83 -0
  35. cpo3-0.0.1/src/linear_algebra/csc.rs +143 -0
  36. cpo3-0.0.1/src/linear_algebra/kkt.rs +660 -0
  37. cpo3-0.0.1/src/linear_algebra/lsmr.rs +679 -0
  38. cpo3-0.0.1/src/linear_algebra/mod.rs +331 -0
  39. cpo3-0.0.1/src/linear_solvers/accelerate.c +91 -0
  40. cpo3-0.0.1/src/linear_solvers/accelerate.rs +196 -0
  41. cpo3-0.0.1/src/linear_solvers/cholmod.c +113 -0
  42. cpo3-0.0.1/src/linear_solvers/cholmod.rs +282 -0
  43. cpo3-0.0.1/src/linear_solvers/faer.rs +324 -0
  44. cpo3-0.0.1/src/linear_solvers/mod.rs +987 -0
  45. cpo3-0.0.1/src/linear_solvers/pardiso.rs +267 -0
  46. cpo3-0.0.1/src/presolve.rs +396 -0
  47. cpo3-0.0.1/src/problem.rs +224 -0
  48. cpo3-0.0.1/src/python/mod.rs +367 -0
  49. cpo3-0.0.1/src/python/settings.rs +75 -0
  50. cpo3-0.0.1/src/recovery.rs +758 -0
  51. cpo3-0.0.1/src/ruiz.rs +379 -0
  52. cpo3-0.0.1/src/settings.rs +195 -0
  53. cpo3-0.0.1/src/solution.rs +242 -0
  54. cpo3-0.0.1/src/solve.rs +423 -0
  55. cpo3-0.0.1/tests/fixtures/problem_data.mps +32 -0
  56. cpo3-0.0.1/tests/fixtures/problem_data.qps +16 -0
  57. cpo3-0.0.1/tests/test_api.py +50 -0
  58. cpo3-0.0.1/tests/test_equality.py +175 -0
  59. cpo3-0.0.1/tests/test_mps.py +92 -0
  60. cpo3-0.0.1/tests/test_presolve.py +58 -0
  61. cpo3-0.0.1/tests/test_solver.py +337 -0
  62. cpo3-0.0.1/uv.lock +658 -0
@@ -0,0 +1,91 @@
1
+ name: Checks
2
+
3
+ on:
4
+ pull_request:
5
+ workflow_call:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ lint:
12
+ runs-on: ubuntu-24.04
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: dtolnay/rust-toolchain@stable
16
+ with:
17
+ components: rustfmt
18
+ - uses: astral-sh/setup-uv@v7
19
+ with:
20
+ python-version: "3.14"
21
+ - run: cargo fmt --check
22
+ - run: uv sync --locked
23
+ - run: uv run --no-sync ruff check .
24
+ - run: uv run --no-sync ruff format --check .
25
+ - run: uv run --no-sync ty check
26
+
27
+ rust:
28
+ runs-on: ubuntu-24.04
29
+ strategy:
30
+ matrix:
31
+ toolchain: ["1.91", stable]
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: dtolnay/rust-toolchain@master
35
+ with:
36
+ toolchain: ${{ matrix.toolchain }}
37
+ - run: cargo test --locked
38
+ - run: cargo test --locked --features mps
39
+ - run: cargo doc --locked --no-deps --features mps
40
+ if: matrix.toolchain == 'stable'
41
+ env:
42
+ RUSTDOCFLAGS: -D warnings
43
+
44
+ test:
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ include:
49
+ - os: ubuntu-24.04
50
+ packages: libcholmod>=5.2,<5.4 mkl
51
+ library-prefix: ""
52
+ - os: windows-2022
53
+ packages: libcholmod>=5.2,<5.4 mkl
54
+ library-prefix: /Library
55
+ - os: macos-15
56
+ packages: libcholmod>=5.2,<5.4
57
+ library-prefix: ""
58
+ - os: macos-15-intel
59
+ packages: libcholmod>=5.2,<5.4
60
+ library-prefix: ""
61
+ runs-on: ${{ matrix.os }}
62
+ defaults:
63
+ run:
64
+ shell: bash -leo pipefail {0}
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - uses: dtolnay/rust-toolchain@stable
68
+ with:
69
+ components: clippy
70
+ - uses: actions/setup-python@v5
71
+ with:
72
+ python-version: "3.14"
73
+ - uses: mamba-org/setup-micromamba@v3
74
+ with:
75
+ environment-name: native
76
+ create-args: ${{ matrix.packages }}
77
+ cache-environment: true
78
+ - name: Configure native library paths
79
+ run: |
80
+ native_prefix="$CONDA_PREFIX${{ matrix.library-prefix }}"
81
+ echo "CHOLMOD_INCLUDE_DIR=$native_prefix/include/suitesparse" >> "$GITHUB_ENV"
82
+ if [[ "$RUNNER_OS" == Linux ]]; then
83
+ echo "LD_LIBRARY_PATH=$native_prefix/lib" >> "$GITHUB_ENV"
84
+ fi
85
+ - run: cargo clippy --locked --all-targets --all-features -- -D warnings
86
+ - run: cargo test --locked --features mps,accelerate,cholmod,pardiso
87
+ - uses: astral-sh/setup-uv@v7
88
+ with:
89
+ python-version: "3.14"
90
+ - run: uv sync --locked --config-setting "build-args=--features=python,mps,accelerate,cholmod,pardiso"
91
+ - run: uv run --no-sync pytest -ra
@@ -0,0 +1,187 @@
1
+ name: Release packages
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ # Manual runs only build and test. Publishing requires a version tag push.
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ checks:
14
+ uses: ./.github/workflows/checks.yml
15
+
16
+ source:
17
+ runs-on: ubuntu-24.04
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: dtolnay/rust-toolchain@stable
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.14"
24
+ - name: Check version and release tag
25
+ env:
26
+ IS_TAG: ${{ github.ref_type == 'tag' }}
27
+ REF_NAME: ${{ github.ref_name }}
28
+ run: |
29
+ python - <<'PY'
30
+ import os
31
+ import tomllib
32
+ from pathlib import Path
33
+ version = tomllib.loads(Path("Cargo.toml").read_text())["package"]["version"]
34
+ if os.environ["IS_TAG"] == "true":
35
+ assert os.environ["REF_NAME"] == f"v{version}", "tag must match Cargo.toml"
36
+ PY
37
+ - run: cargo publish --dry-run --locked
38
+ - uses: PyO3/maturin-action@v1
39
+ with:
40
+ command: sdist
41
+ args: --out dist
42
+ - uses: actions/upload-artifact@v4
43
+ with:
44
+ name: sdist
45
+ path: dist/*.tar.gz
46
+ if-no-files-found: error
47
+
48
+ wheels:
49
+ needs: source
50
+ strategy:
51
+ fail-fast: false
52
+ matrix:
53
+ include:
54
+ - os: ubuntu-24.04
55
+ target: x86_64-unknown-linux-gnu
56
+ features: python,mps,cholmod,pardiso
57
+ packages: libcholmod>=5.2,<5.4 mkl
58
+ interpreter: python3.10
59
+ python-path: bin/python
60
+ - os: windows-2022
61
+ target: x86_64-pc-windows-msvc
62
+ features: python,mps,cholmod,pardiso
63
+ packages: libcholmod>=5.2,<5.4 mkl
64
+ interpreter: python
65
+ python-path: Scripts/python.exe
66
+ - os: macos-15-intel
67
+ target: x86_64-apple-darwin
68
+ features: python,mps,accelerate,cholmod
69
+ packages: libcholmod>=5.2,<5.4
70
+ interpreter: python
71
+ python-path: bin/python
72
+ - os: macos-15
73
+ target: aarch64-apple-darwin
74
+ features: python,mps,accelerate,cholmod
75
+ packages: libcholmod>=5.2,<5.4
76
+ interpreter: python
77
+ python-path: bin/python
78
+ runs-on: ${{ matrix.os }}
79
+ defaults:
80
+ run:
81
+ shell: bash -leo pipefail {0}
82
+ env:
83
+ MACOSX_DEPLOYMENT_TARGET: "13.0"
84
+ # Relative to the extracted source, also valid inside manylinux's container.
85
+ CHOLMOD_INCLUDE_DIR: target/headers/CHOLMOD/Include
86
+ steps:
87
+ - uses: actions/checkout@v4
88
+ - uses: actions/download-artifact@v4
89
+ with:
90
+ name: sdist
91
+ path: dist
92
+ - name: Extract the source distribution
93
+ run: |
94
+ mkdir -p target/wheel-source
95
+ tar -xzf dist/*.tar.gz --strip-components=1 -C target/wheel-source
96
+ - name: Fetch CHOLMOD 5.3.1 headers only
97
+ uses: actions/checkout@v4
98
+ with:
99
+ repository: DrTimothyAldenDavis/SuiteSparse
100
+ ref: v7.10.1
101
+ path: target/wheel-source/target/headers
102
+ sparse-checkout: |
103
+ CHOLMOD/Include
104
+ SuiteSparse_config
105
+ - name: Prepare the header search directory
106
+ run: >-
107
+ cp target/wheel-source/target/headers/SuiteSparse_config/SuiteSparse_config.h
108
+ target/wheel-source/target/headers/CHOLMOD/Include/
109
+ - uses: actions/setup-python@v5
110
+ with:
111
+ python-version: "3.10"
112
+ - uses: PyO3/maturin-action@v1
113
+ with:
114
+ working-directory: target/wheel-source
115
+ target: ${{ matrix.target }}
116
+ manylinux: "2_28"
117
+ docker-options: -e CHOLMOD_INCLUDE_DIR
118
+ args: >-
119
+ --release --locked --out ../../dist
120
+ --interpreter ${{ matrix.interpreter }}
121
+ --features ${{ matrix.features }}
122
+ - uses: astral-sh/setup-uv@v7
123
+ - name: Test installed wheel without optional runtimes
124
+ env:
125
+ CPO3_CHOLMOD: /cpo3-missing-runtime/cholmod
126
+ CPO3_MKL_RT: /cpo3-missing-runtime/mkl
127
+ run: |
128
+ cp -R tests "$RUNNER_TEMP/wheel-tests"
129
+ cd "$RUNNER_TEMP"
130
+ for version in 3.10 3.15; do
131
+ env_dir="$RUNNER_TEMP/wheel-python-$version"
132
+ uv venv --python "$version" "$env_dir"
133
+ python_bin="$env_dir/${{ matrix.python-path }}"
134
+ uv pip install --python "$python_bin" "$GITHUB_WORKSPACE"/dist/*.whl pytest
135
+ "$python_bin" -m pytest -ra wheel-tests/test_solver.py::test_numerical_solve -k "faer or accelerate"
136
+ done
137
+ - uses: mamba-org/setup-micromamba@v3
138
+ with:
139
+ environment-name: native
140
+ create-args: ${{ matrix.packages }}
141
+ cache-environment: true
142
+ - name: Test installed wheel with optional runtimes
143
+ run: |
144
+ if [[ "$RUNNER_OS" == Linux ]]; then
145
+ export LD_LIBRARY_PATH="$CONDA_PREFIX/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
146
+ fi
147
+ cd "$RUNNER_TEMP"
148
+ for version in 3.10 3.15; do
149
+ python_bin="$RUNNER_TEMP/wheel-python-$version/${{ matrix.python-path }}"
150
+ "$python_bin" -m pytest -ra wheel-tests
151
+ done
152
+ - uses: actions/upload-artifact@v4
153
+ with:
154
+ name: wheels-${{ matrix.target }}
155
+ path: dist/*.whl
156
+ if-no-files-found: error
157
+
158
+ publish-pypi:
159
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
160
+ needs: [checks, source, wheels]
161
+ runs-on: ubuntu-24.04
162
+ environment: pypi
163
+ permissions:
164
+ id-token: write
165
+ steps:
166
+ - uses: actions/download-artifact@v4
167
+ with:
168
+ pattern: wheels-*
169
+ merge-multiple: true
170
+ path: dist
171
+ - uses: actions/download-artifact@v4
172
+ with:
173
+ name: sdist
174
+ path: dist
175
+ - uses: pypa/gh-action-pypi-publish@release/v1
176
+
177
+ publish-crates:
178
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
179
+ needs: [checks, source, wheels]
180
+ runs-on: ubuntu-24.04
181
+ environment: crates-io
182
+ steps:
183
+ - uses: actions/checkout@v4
184
+ - uses: dtolnay/rust-toolchain@stable
185
+ - run: cargo publish --locked
186
+ env:
187
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
cpo3-0.0.1/.gitignore ADDED
@@ -0,0 +1,31 @@
1
+ # Rust
2
+ /target/
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.so
8
+ *.dylib
9
+ *.dll
10
+ /.venv/
11
+ /.pytest_cache/
12
+ /.ruff_cache/
13
+
14
+ # Distribution artifacts
15
+ /dist/
16
+ /wheels/
17
+ *.egg-info/
18
+
19
+ # Editors and operating systems
20
+ .DS_Store
21
+ .idea/
22
+ .vscode/
23
+
24
+ experiments/
25
+
26
+ # Local configuration and benchmark caches
27
+ .env
28
+ .env.*
29
+ .envrc
30
+ /benchmarks/.cache/
31
+ /benchmarks/refactor/
@@ -0,0 +1,2 @@
1
+ 3.14
2
+
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1 — 2026-11-11
4
+
5
+ Initial experimental release. APIs and numerical behavior may change between
6
+ releases.
7
+
8
+ - Sparse convex LP and QP solver with zero and nonnegative cone constraints.
9
+ - Rust API and typed Python interface, including warm starts and infeasibility
10
+ certificates.
11
+ - Presolve, Ruiz equilibration, and continuous MPS/QPS input.
12
+ - Faer factorization, with optional Accelerate, CHOLMOD, and MKL PARDISO backends.
13
+ - Python wheels for Linux x86-64, Windows x86-64, and macOS Intel/Apple Silicon.
14
+ Wheels use external CHOLMOD/MKL runtimes; macOS wheels include Accelerate support.
15
+
16
+ Second-order and semidefinite cone solving, integer optimization, and
17
+ free-threaded Python wheels are outside this release's supported scope.