{"id":21000,"library":"better-optimize","title":"better-optimize","description":"A drop-in replacement for scipy.optimize functions with quality-of-life improvements, such as automatic gradient computation via JAX, progress bars, and early stopping. Current version is 0.4.1, released in 2025. The project is under active development with monthly releases.","status":"active","version":"0.4.1","language":"python","source_language":"en","source_url":"https://github.com/jessegrabowski/better_optimize.git","tags":["optimization","JAX","scipy","drop-in","quality-of-life"],"install":[{"cmd":"pip install better-optimize","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for compatibility with scipy.optimize functions; better-optimize wraps them.","package":"scipy","optional":false},{"reason":"Enables automatic gradient computation (optional, but recommended for most features).","package":"jax","optional":true}],"imports":[{"note":"better-optimize provides a drop-in replacement; using scipy's version won't get the QoL improvements.","wrong":"from scipy.optimize import minimize","symbol":"minimize","correct":"from better_optimize import minimize"}],"quickstart":{"code":"import jax.numpy as jnp\nfrom better_optimize import minimize\n\ndef rosen(x):\n    return (1 - x[0])**2 + 100 * (x[1] - x[0]**2)**2\n\nx0 = jnp.array([0.0, 0.0])\nres = minimize(rosen, x0, method='BFGS')\nprint(res.x)","lang":"python","description":"Minimize the Rosenbrock function using BFGS. Note: JAX arrays are used for automatic differentiation."},"warnings":[{"fix":"Upgrade Python to 3.12 or later.","message":"This library requires Python >=3.12. Attempting to install on older versions will fail.","severity":"breaking","affected_versions":"0.4.1"},{"fix":"Convert NumPy arrays to JAX arrays via jnp.array(your_array).","message":"The library expects JAX arrays as inputs when using JAX-based gradients. Using NumPy arrays may cause errors or unexpected behavior.","severity":"gotcha","affected_versions":"0.3.0+"},{"fix":"Use 'progress_callback' instead of 'callback'.","message":"The 'callback' parameter in earlier versions was renamed to 'progress_callback'. The old name still works but will be removed in 0.5.0.","severity":"deprecated","affected_versions":"0.3.0 - 0.4.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install better-optimize' and ensure you are using the correct import name 'better_optimize' (underscore).","cause":"Library not installed or installed under a different name.","error":"ModuleNotFoundError: No module named 'better_optimize'"},{"fix":"Convert inputs to JAX arrays: x_jax = jnp.array(x_numpy).","cause":"Passing NumPy arrays directly to functions that expect JAX arrays.","error":"TypeError: expected JAX array, got numpy.ndarray"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}