skillfed

sparsediffpy

Python bindings for SparseDiffEngine algorithmic differentiation

sparsediffpy v0.6.1 1.5M downloads/30d#3,828 on PyPI
Permissive license Apache-2.0 Active released

What it is and what it does

SparseDiffPy is a Python wrapper around SparseDiffEngine, a C library specialized in computing sparse Jacobians and Hessians—the first and second derivatives of functions that have sparse structure. It bridges high-level Python code to low-level compiled differentiation routines, allowing developers to leverage algorithmic differentiation without writing C directly.

The package depends only on numpy and targets modern Python versions (3.11+), with pre-built wheels available for macOS, Linux, and Windows across multiple architectures. It is actively maintained with no known security vulnerabilities. The primary use case is numerical optimization, machine learning, and scientific computing workflows where computing derivatives efficiently is critical and the underlying functions exhibit sparsity patterns that can be exploited for speed.

Use it for:

  • Computing sparse Jacobians for large-scale optimization problems where most partial derivatives are zero.
  • Efficient Hessian computation in machine learning model training and hyperparameter optimization.
  • Numerical simulations and scientific computing where derivative evaluation is a bottleneck.
  • Sensitivity analysis in engineering and physics simulations with sparse dependency graphs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SparseDiffPy provides Python bindings to compute sparse Jacobians and Hessians via the SparseDiffEngine C library, enabling efficient algorithmic differentiation for numerical optimization and machine learning workflows.

Yes, if you need efficient sparse Jacobian or Hessian computation in Python. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and provides a clean Python interface to a specialized C library. Install friction is moderate but manageable with pre-built wheels. Primary consideration: verify that the _sparsediffengine API matches your differentiation needs before committing to a production workflow.

Install

sparsediffpy on PyPI

pip

pip install sparsediffpy

uv

uv add sparsediffpy

poetry

poetry add sparsediffpy

Installing sparsediffpy

Before you install

Medium install friction due to compiled wheels across multiple Python versions and platforms. Package is actively maintained with a recent release, and requires only numpy as a runtime dependency.

License in practice

Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions beyond attribution.

Quickstart

pip install sparsediffpy
from sparsediffpy import _sparsediffengine

Requires Python 3.11 or later (requires_python: >=3.11).

Verify before relying

  • Specific capabilities and API surface of _sparsediffengine module beyond import.
  • Performance characteristics or scale limits for sparse Jacobian/Hessian computation.
  • Whether the package is suitable for production use or primarily experimental.
  • Typical use patterns and integration with numpy workflows.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.11)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 32 days since the last release
First released
Downloads 1,504,507/month — #3,828 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sparsediffpy-0.6.1-cp311-cp311-macosx_10_9_universal2.whl; sparsediffpy-0.6.1-cp311-cp311-macosx_10_9_x86_64.whl; sparsediffpy-0.6.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; sparsediffpy-0.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; sparsediffpy-0.6.1-cp311-cp311-win_amd64.whl; sparsediffpy-0.6.1-cp312-cp312-macosx_10_13_universal2.whl; sparsediffpy-0.6.1-cp312-cp312-macosx_10_13_x86_64.whl; sparsediffpy-0.6.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; sparsediffpy-0.6.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; sparsediffpy-0.6.1-cp312-cp312-win_amd64.whl; sparsediffpy-0.6.1-cp313-cp313-macosx_10_13_universal2.whl; sparsediffpy-0.6.1-cp313-cp313-macosx_10_13_x86_64.whl; sparsediffpy-0.6.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; sparsediffpy-0.6.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; sparsediffpy-0.6.1-cp313-cp313-win_amd64.whl; sparsediffpy-0.6.1-cp314-cp314-macosx_10_15_universal2.whl; sparsediffpy-0.6.1-cp314-cp314-macosx_10_15_x86_64.whl; sparsediffpy-0.6.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; sparsediffpy-0.6.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; sparsediffpy-0.6.1-cp314-cp314-win_amd64.whl

Tags

sparse jacobian hessian computationalgorithmic differentiation pythonsparse automatic differentiationjacobian matrix calculationefficient gradient computation
automatic-differentiationnumerical-optimizationsparse-computation

More Mathematics packages