--- id: better-optimize version: "0.4.2" license: MIT License license_treatment: permissive maintenance: active --- # better-optimize — A drop-in replacement for scipy optimize functions with quality of life improvements License: permissive · Maintenance: active · Downloads: 206.4K/mo ## What it is and what it does better_optimize is a convenience layer over scipy's optimization routines that reduces boilerplate and adds visibility into long-running solves. It replaces scipy's nested `options` dictionaries with flat keyword arguments, normalizes callback signatures across different optimizers (minimize, root, basinhopping, differential_evolution), and provides optional rich progress bars showing iteration counts, elapsed time, objective values, and gradient/Hessian norms. It also handles fused objective functions that return multiple values (loss, gradient, Hessian) together, caching intermediate results to avoid redundant computation. The package includes multi_optimize for parallel optimization from multiple starting points using different initialization strategies (uniform, normal, Sobol, Latin hypercube) and backends (sequential, loky, threading). It depends on numpy, scipy, rich, joblib, pandas, and threadpoolctl. Early stopping is supported by raising StopOptimization from a callback, and all results are standard scipy OptimizeResult objects, so downstream code needs no changes. Use it for: - Minimize a function with a live progress bar to monitor convergence without blocking output. - Run the same callback logic across minimize, root, and basinhopping without rewriting for each method's signature. - Optimize a triple-fused objective that computes value, gradient, and Hessian together, avoiding redundant computation. - Search for the global minimum by launching many local optimizations in parallel from random starting points. - Stop an optimization early when a target loss is reached, returning the best result so far. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A wrapper around scipy's optimize.minimize and optimize.root that adds progress bars, early stopping, flattened keyword arguments, and a unified callback API across different optimization methods. Yes, if you regularly use scipy's optimize functions and want cleaner syntax, progress visibility, and unified callbacks. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe addition. Best suited for interactive work and research; production code that calls scipy directly may not need the wrapper overhead. ## Install pip install better-optimize uv add better-optimize poetry add better-optimize ## Installing better-optimize Before you install: Low friction: pure Python wheel with standard scientific dependencies (numpy, scipy, rich, joblib, pandas, threadpoolctl). Active maintenance with recent releases. License in practice: MIT License permits commercial and private use with minimal restrictions; attribution required but no copyleft obligations. Quickstart: pip install better_optimize import numpy as np from better_optimize import minimize def rosenbrock(x): return sum(100.0*(x[1:] - x[:-1]**2.0)**2.0 + (1 - x[:-1])**2.0) result = minimize( rosenbrock, x0=np.array([-1.0, 2.0]), method="L-BFGS-B", tol=1e-6, maxiter=1000, progressbar=True, ) Requires Python 3.12 or later. Verify before relying: - Whether progress bar display works correctly in all headless/non-terminal environments as claimed. - Performance overhead of the wrapper layer relative to direct scipy calls for large-scale problems. - Compatibility of fused function detection with all scipy optimizer variants. ## Package facts - License: MIT License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 206.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags scipy optimize wrapper, optimization progress bar, minimize with early stopping, scipy minimize alternative, optimization callback unified, basinhopping progress tracking, parallel optimization multiple starts, optimization-wrapper, scipy-convenience, parallel-search [View on SkillFed](https://skillfed.io/packages/better-optimize) · [View on PyPI](https://pypi.org/project/better-optimize/)