sqp-craft
Sequential quadratic programming (SQP) for smooth constrained nonlinear
problems, with a native Rust solver: damped BFGS updates of a dense Hessian
approximation, step QPs solved by active-set or Clarabel, and an ℓ1 merit
line search. Since 0.19.0 the qp_solver="auto" default uses active-set with
elastic steps for full/block BFGS and Clarabel for partitioned/exact curvature. Results report
stationarity, complementarity and dual-sign residuals of the KKT conditions,
and kkt_residuals and check_derivatives check points and derivatives
independently.
Install
python -m pip install sqp-craft
Wheels (abi3, CPython 3.10 or newer) cover Linux x86_64, Windows x64 and macOS x86_64/arm64 and need no compiler. On other platforms pip builds the source distribution, which needs Rust 1.85 or newer. The package depends on nothing else at run time.
Example
from sqp_craft import ProblemSpec, check_derivatives, solve
class Model:
"""minimize (x0-2)^2 + (x1-1)^2 subject to x0^2 - x1 <= 0, x0 + x1 <= 2"""
def functions(self, x):
return (x[0] - 2) ** 2 + (x[1] - 1) ** 2, [x[0] ** 2 - x[1], x[0] + x[1]]
def derivatives(self, x): # gradient, then the Jacobian values in CSR order
return [2 * (x[0] - 2), 2 * (x[1] - 1)], [2 * x[0], -1.0, 1.0, 1.0]
inf = float("inf")
spec = ProblemSpec(lower=[-5, -5], upper=[5, 5],
constraint_lower=[-inf, -inf], constraint_upper=[0, 2],
jacobian_indptr=[0, 2, 4], jacobian_indices=[0, 1, 0, 1])
assert check_derivatives(spec, Model(), [0.5, 0.5]).passed
result = solve(spec, Model(), [0.5, 0.5], method="sqp")
print(result.status, result.candidate, result.evaluation.objective)
# converged, candidate ≈ [1, 1], objective ≈ 1
Pass method="sqp": the default method="dummy" only evaluates the start
point. SqpOptions configures the solver (iteration, callback and time
limits, KKT tolerances, qp_solver="auto", "clarabel" or "active-set",
elastic_mode=None for the policy default or an explicit boolean);
invalid values raise ValueError. Callbacks run serially on the calling
thread.
Limits
- Smooth (twice continuously differentiable) objective and constraints with first derivatives; kinks, noise and branches break BFGS and the line search.
- Full and uniform-block BFGS accept up to 256 variables. Experimental structured SQP uses sparse curvature and Clarabel for larger models with declared structure.
- A local method:
convergedmeans a first-order KKT point within the tolerances, not a global optimum. Use several starts for multimodal models.
More
- Repository, with the multistart
examples and the source build; the Rust crates start at
sqp-craft-solver - AI agent guide: modelling, options, results, multistart and the job API
- Changelog
- Shared solver-selection guide
and ecosystem overview:
when black-box optimization (fcmaes) or LP/MIP (LP-IP-craft) fits better,
and durable shell/MCP jobs through the
sqp-job-worker(built from source)
MIT license.
See backend selection for migration. Explicit
backends retain nonelastic behavior unless elastic_mode=True is requested.
Reports expose the resolved qp_solver and elastic_mode, including before
the first QP on cancelled or limited runs.
Metadata
Release files for sqp-craft 0.21.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 |
|---|---|---|---|---|
| sqp_craft-0.21.0.tar.gz | 519.7 kB | Without provenance | Details for sqp_craft-0.21.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| sqp_craft-0.21.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for sqp_craft-0.21.0-cp310-abi3-win_amd64.whl |
| sqp_craft-0.21.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for sqp_craft-0.21.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| sqp_craft-0.21.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for sqp_craft-0.21.0-cp310-abi3-macosx_11_0_arm64.whl |
| sqp_craft-0.21.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for sqp_craft-0.21.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 3.4 MB
Release files / sqp_craft-0.21.0.tar.gz
| Download URL | sqp_craft-0.21.0.tar.gz |
|---|---|
| Size | 519.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7d042ca9c89b18a37223866bae5f58dc3c61778053cdf94bfc8772d012b80de
|
|
BLAKE2b-256 checksum How to use checksums |
b7b1f844e008434f616ce7cade7588fe4af193e9349edfd5da888786bd1e3ace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqp_craft-0.21.0-cp310-abi3-win_amd64.whl
| Download URL | sqp_craft-0.21.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 649.1 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0c5c6a49d2a8c20fc0a18659b096c4fdc4351a61a248814507f7d52d4214cba6
|
|
BLAKE2b-256 checksum How to use checksums |
dcdba957af4404e88f3ac3ac4d14ff0104098a8979730197818fbe985a7a1185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqp_craft-0.21.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | sqp_craft-0.21.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 813.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a361c2b3c45cd060449b852a5441fd8a7a2c27a97ed3985ed357bd66b4e39716
|
|
BLAKE2b-256 checksum How to use checksums |
dbcd367d08e40d25870c35836acaff8513dc525d94ba84c24022c1b63e00718c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqp_craft-0.21.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | sqp_craft-0.21.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 716.9 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0ef22c46cb2fd8d0578c42ea7e3b450c95f6611320cc07ebf0df65ef6772e60b
|
|
BLAKE2b-256 checksum How to use checksums |
ae69f0725c48d648753ea59165a76a38e0a2c86e5569a1c32ec9467a840b79ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqp_craft-0.21.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | sqp_craft-0.21.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 730.6 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
d9b446dd26ab8ce5188dab375c0ade2039be000796b809a2346d99cb8469a93f
|
|
BLAKE2b-256 checksum How to use checksums |
4926aa3944b2beb32f94ee5f5c4b7630f130e38080f32df5d107cc095cf48449
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for sqp-craft 0.21.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.