Source-linked AI summary

SciPy 1.0--Fundamental Algorithms for Scientific Computing in Python

Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, CJ Carey, İlhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, SciPy 1. 0 Contributors

arXiv:1907.10121v1cs.MScs.DScs.SEphysics.comp-ph

TL;DR

SciPy is a foundational library for scientific Python, despite emerging from a small, lightly funded student effort. The paper surveys its scope and development, reporting more than 19 million downloads across PyPI and conda in 2017.

  • Problem

    SciPy’s foundational role in scientific computing is striking given its origins in a small, lightly funded student effort amid established, well-funded research software.

    Source: Introduction · p. 2
  • Method

    The paper describes SciPy’s scope as fundamental algorithms, aiming for complete coverage in slower-moving areas and building blocks that work with specialized packages elsewhere.

    Source: Project scope · p. 5
  • Results

    13,096,468 PyPI downloads and 5,776,017 conda downloads were recorded for SciPy in 2017, establishing a lower bound on total user downloads.

    Source: Discussion · p. 13
  • Takeaways & Limitations

    SciPy provides a foundation on which higher-level scientific libraries, including scikit-learn and scikit-image, are built.

    Source: Introduction · p. 2

    The authors identify SciPy’s low-level Cython code as needing modernization, including migration to typed memoryviews for NumPy arrays.

    Source: Discussion · p. 13

Abstract

from arXiv · show

SciPy is an open source scientific computing library for the Python programming language. SciPy 1.0 was released in late 2017, about 16 years after the original version 0.1 release. SciPy has become a de facto standard for leveraging scientific algorithms in the Python programming language, with more than 600 unique code contributors, thousands of dependent packages, over 100,000 dependent repositories, and millions of downloads per year. This includes usage of SciPy in almost half of all machine learning projects on GitHub, and usage by high profile projects including LIGO gravitational wave analysis and creation of the first-ever image of a black hole (M87). The library includes functionality spanning clustering, Fourier transforms, integration, interpolation, file I/O, linear algebra, image processing, orthogonal distance regression, minimization algorithms, signal processing, sparse matrix handling, computational geometry, and statistics. In this work, we provide an overview of the capabilities and development practices of the SciPy library and highlight some recent technical developments.

Introduction

SciPy provides foundational numerical algorithms and data structures for scientific computing in Python, and its 1.0 release marked API maturity after extensive adoption in research and industry.

Introduction

  • SciPy supplies algorithms for diverse scientific problems and specialized data structures, builds on NumPy, and underpins higher-level libraries such as scikit-learn and scikit-image.Its routines support optimization, integration, interpolation, eigenvalue problems, algebraic and differential equations, sparse matrices, and k-dimensional trees.Source: Introduction · p. 2
  • SciPy is relied on worldwide, including by gravitational-wave analysis scripts 5,6,7,8 and the M87 black hole imaging project 9.Source: Introduction · p. 2
  • Version 1.0 traditionally signals an API mature enough for production pipelines, although SciPy had already become a standard with extensive research and industry adoption.Source: Introduction · p. 2
  • SciPy began with little funding and was written mainly by graduate students, many lacking computer-science training and advisor support, despite competing with well-funded research software.Source: Introduction · p. 2
  • An open-tool philosophy and focused, friendly community helped build SciPy’s package ecosystem and social activities, with shared standards for implementation, documentation, testing, and improvement.Source: Introduction · p. 2
  • The paper’s following background selects milestones in SciPy’s growth while recognizing the many contributors whose work made the project possible.Source: Introduction · p. 2

Background

SciPy grew from Python’s general-purpose, array-centered scientific ecosystem into a mature scientific algorithm library. At the time of writing, it comprised nearly 600,000 lines across 16 subpackages.

Background

  • Python lacked built-in scientific data structures and algorithms, but scientists could wrap C and Fortran libraries, while Numeric provided a shared multidimensional array object for interoperability.Source: Background · pp. 2–3

SciPy Begins

  • By 2001, SciPy was created as a library to subsume packages that supplied scientific algorithms and wrapped existing C and Fortran libraries.Earlier packages covered signal processing, special functions, sparse matrices, quadrature, optimization, Fourier transforms, and more.Source: SciPy Begins · p. 3

SciPy Matures

  • As SciPy matured, its scope narrowed while the ecosystem expanded through scikit packages, and its tooling, development, documentation, and release processes became more professional.A documentation effort involving over 75 contributors produced an 884-page manual.Source: SciPy Matures · p. 4

SciPy Today

  • At the time of writing, SciPy comprised nearly 600,000 lines of code in 16 subpackages, with over 110,000 GitHub repositories and 6,500 packages depending on it.Source: SciPy Today · p. 5

Architecture and implementation choices

SciPy targets fundamental, broadly useful scientific algorithms for single-machine, in-memory computing, balancing comprehensive coverage in slower-changing areas with core building blocks that work alongside specialized packages. Its modular library favors stable, maintainable implementations and cautious, backward-compatible evolution of its interfaces.

Project scope

  • SciPy’s scope prioritizes algorithms relevant across scientific fields and demonstrably important, with complete coverage in slower-moving areas and building blocks that complement specialized packages elsewhere.Its software scope is in-memory computing on single machines; distributed computing and GPU support are out of scope.Source: Project scope · pp. 5–6

Package organization

  • The 16 subpackages span mathematical building blocks, data structures, numerical algorithms, and higher-level analysis, while the legacy misc package is being deprecated or relocated.Capabilities range from transforms, integration and interpolation to I/O, linear algebra, optimization, signal and image processing, sparse and spatial algorithms, and statistics.Source: Package organization · p. 6

Language choices

  • SciPy’s mix of languages combines Python for new features with Cython and established C and Fortran libraries for performance and reliability.Cython also serves as glue to low-level libraries and accelerates heavily used inner loops; the language distribution is approximately 50% Python, 25% Fortran, 20% C, 3% Cython, and 2% C++.Source: Language choices · p. 7
  • SciPy generally avoids new languages and major dependencies in favor of long-term stability, while requiring its full test suite to pass under PyPy’s JIT.GPU acceleration and newer JIT or transpiling approaches remain outside the main library’s remit, though compatibility efforts have increased.Source: Language choices · p. 7

API and ABI evolution

  • SciPy’s approximately 1,500-function API permits additions but changes or removals only when benefits justify user costs and after at least one year of deprecation warnings.The policy favors clarity while strongly discouraging backward-incompatible changes.Source: API and ABI evolution · p. 7
  • SciPy also exposes C and Cython interfaces and aims to keep its long-stable ABI backward compatible.Source: API and ABI evolution · p. 7

Key technical improvements · Data structures

SciPy’s recent technical improvements include faster sparse-matrix operations and expanded sparse APIs, alongside a rewritten cKDTree with new capabilities and performance improvements.

Sparse matrices

  • CSR and CSC are SciPy’s most important sparse formats, providing fast major-axis indexing and matrix-vector multiplication.SciPy offers seven sparse matrix formats, used throughout the library and by dependent packages.Source: Sparse matrices · p. 8
  • Sparse-matrix internals were rewritten, making CSR and CSC iteration and slicing up to 35% faster and increasing COO/DIA-to-CSR/CSC conversion speed.SuperLU93 was updated to version 5.2.1, enhancing low-level implementations used by some sparse offerings.Source: Sparse matrices · p. 8
  • Sparse matrices and linear operators gained @ multiplication, while scipy.sparse.norm, scipy.sparse.random, and NumPy-aligned API changes expanded sparse functionality.The new functions compute sparse matrix norms and draw random variates from arbitrary distributions, respectively.Source: Sparse matrices · p. 8

cKDTree

  • cKDTree was rewritten in templated C++ and gained periodic boundary-condition support for simulations of physical processes.Source: cKDTree · p. 8
  • cKDTree.query was reimplemented in C++, with memory leaks removed and GIL release enabling multiple threads; performance generally improved while loglinear complexity was preserved [98, 99, 100].Its search time complexity was approximately loglinear in 2013, consistent with its formal description.Source: cKDTree · p. 8
  • The sparse distance matrix routine supports Minkowski p-norms from 1 to infinity and uses DOK construction, which can be 7 times faster than CSR construction [101].It ignores distances above a user-provided threshold, releases the Python GIL during C++ construction, provides amortized constant-time distance retrieval [102], and can convert to CSR, CSC, or COO.Source: cKDTree · p. 8
  • The cKDTree dual-tree counting algorithm was enhanced to support weights [103, 104], which are essential for applications such as computing galaxy correlation functions [105].Source: cKDTree · p. 8

Unified bindings to compiled code · Cython bindings for BLAS, LAPACK, and special · Numerical optimization

SciPy 1.0 expanded access to compiled routines through low-level callbacks and Cython bindings, while adding optimization methods for linear, local nonlinear, and global problems.

LowLevelCallable

  • Since SciPy 0.19, scipy.LowLevelCallable can wrap C functions from PyCapsule, ctypes, or cffi, and can generate callbacks from Cython modules.These callbacks reduce the overhead of calling compiled functions directly from Python.Source: LowLevelCallable · p. 8

Cython bindings for BLAS, LAPACK, and special

  • Cython wrappers expose BLAS, LAPACK, and special functions directly, avoiding Python-call overhead and yielding one-to-two-order-of-magnitude gains in many use cases.Other extensions can use the interfaces without linking to the wrapped libraries, a benefit that avoids handling Fortran compiler ABIs and name mangling; most wrappers are generated from routine type information stored in data files.Source: Cython bindings for BLAS, LAPACK, and… · pp. 8–9

Numerical optimization

  • SciPy’s optimization methods cover root-finding and optimization problems, with minimize providing a unified interface for local nonlinear minima.The paper presents the four new unconstrained methods as additions to SciPy’s numerical optimization capabilities.Source: Numerical optimization · p. 9, Nonlinear Optimization · p. 9

Linear Optimization

  • The new interior-point linprog solves all 90+ tested NETLIB benchmarks and is faster than simplex except on the smallest problems.Its homogeneous self-dual formulation supplies infeasibility or unboundedness certificates; sparse support and compiled linear solvers make it suitable for medium and large problems, including cases where the existing simplex implementation fails.Source: Linear Optimization · p. 9

Nonlinear Optimization

  • For local nonlinear minima, minimize added dogleg, trust-ncg, trust-exact, and trust-krylov, which build trust-region models from first- and second-derivative information.trust-exact solves the subproblem nearly exactly but stores and factors the Hessian each iteration, potentially limiting problems with ≥1000 variables; trust-ncg and trust-krylov avoid explicit Hessian storage and factorization for large-scale problems.Source: Nonlinear Optimization · p. 9
  • SciPy added differential evolution, a stochastic global optimizer that evolves a candidate population, and a benchmark suite of 196 global optimization problems.Each iteration combines existing candidates to generate trials, updating the population when a trial improves it.Source: Nonlinear Optimization · p. 9
  • Table 1 characterizes minimize algorithms by derivatives, Hessian factorization, convergence, and supported constraints, distinguishing bound, equality, and inequality constraints.Its convergence categories describe local rates or guarantees of reaching a stationary point, not a global minimum.Source: Nonlinear Optimization · p. 10, Table 1 · p. 10

Statistical distributions · Polynomial interpolators

SciPy’s statistical distributions share a framework for sampling, evaluating CDFs and PDFs, and fitting parameters, while its polynomial interpolators were redesigned as modular building blocks. Together, these sections describe broad distribution coverage and layered tools for constructing and evaluating interpolators.

Statistical distributions

  • scipy.stats includes 96 continuous, 13 discrete univariate, and 10 multivariate distributions, with shared methods for sampling, CDF/PDF evaluation, and parameter fitting.Distribution-specific implementations are used when available; otherwise, generic methods such as numerical integration of the PDF provide defaults.Source: Statistical distributions · p. 10
  • Recent scipy.stats additions include a histogram-based distribution and the multinomial distribution, which is used in natural language processing (see133).Source: Statistical distributions · p. 10

Polynomial interpolators

  • SciPy’s former reliance on FITPACK’s monolithic design and API limited users and developers; the library introduced a modular polynomial-interpolator design over several releases.The historical library is identified as the FITPACK Fortran library by P. Dierckx78,134.Source: Polynomial interpolators · p. 10
  • The redesign aimed to provide basic piecewise-polynomial objects, algorithms for constructing interpolators, and building blocks for users to create additional interpolators.Source: Polynomial interpolators · p. 10
  • PPoly, BPoly, and BSpline represent univariate piecewise polynomials and support efficient vectorized evaluation, differentiation, integration, and root-finding.PPoly uses the power basis, BPoly the Bernstein basis suitable for Bezier curves, and BSpline represents linear combinations of B-spline basis elements.137Source: Polynomial interpolators · pp. 10–11
  • CubicSpline constructs a twice-differentiable piecewise cubic function, while Akima1DInterpolator and PCHIPInterpolator provide C1-continuous, monotone, shape-preserving interpolation (138; 139,140).Source: Polynomial interpolators · p. 11

Test and benchmark suite

SciPy’s test and benchmark suite combines broad automated testing and code-coverage tracking with performance monitoring over the project’s history. The passages report test coverage at SciPy 1.0 and performance improvements in cKDTree.query.

Test suite

  • SciPy’s pytest suite contains more than 13,000 unit tests and runs in a CI matrix across POSIX and Windows (32/64-bit) platforms, covering Python 2.7, 3.4, 3.5, and 3.6.Tests include code linting with pyflakes and pycodestyle; the full suite also passes with PyPy.Source: Test suite · p. 11
  • At SciPy 1.0, unit tests covered approximately 45% of 462,574 compiled lines and nearly 87% of 106,878 Python lines.Coverage was measured with gcov for compiled code and pytest-cov for Python code.Source: Figure 3 · p. 11, Test suite · p. 11

Benchmark suite

  • Since February 2015, SciPy has monitored performance with Airspeed Velocity, and its run.py script generates benchmark results over time with one console command.Documentation is also automatically built and published by CircleCI to facilitate evaluation of documentation changes and integrity.Source: Benchmark suite · p. 11, Test suite · p. 11
  • cKDTree.query benchmarks show substantial performance improvements after full Cythonization and again after the implementation was rewritten in C++.The benchmark builds a k-d tree from 10,000 uniformly distributed points and queries nearest neighbors for 1,000 points.Source: Benchmark suite · p. 11, Figure 4 · p. 12

Project organization and community

SciPy combines community-governed development with broad contributor and maintainer participation, while fostering reciprocal collaboration with downstream scientific Python projects.

Governance

  • An 18-member Steering Council oversees daily development, while BDFL Pauli Virtanen can intervene if the Council cannot agree.Council members merge changes only when there are no substantive community objections; its chair initiates biannual technical reviews.Source: Governance · p. 12
  • The Code of Conduct sets five participation guidelines and breach-reporting procedures, and the Diversity Statement welcomes participation by everyone.The guidelines emphasize openness, empathy and patience, collaboration, inquisitiveness, and careful wording.Source: Governance · p. 12

Maintainers and contributors

  • About 100 people contribute per six-month release cycle, while 15 active maintainers review contributions and help the project progress.Anyone with the interest and skills can contribute; maintainers are selected on a rolling basis from contributors with a significant record of high-quality work.Source: Maintainers and contributors · p. 12

Downstream projects

  • SciPy supports reciprocal ecosystem collaboration: binned statistics developed in an Astropy-affiliated package were later incorporated into SciPy.The project describes itself as a catalyst for cross-fertilization across the Python scientific computing community.Source: Downstream projects · pp. 12–13

Discussion

SciPy’s large user base and developer community are reflected in its downloads, contributors, and prominent uses. The project also identifies ongoing improvement needs and benefits from sustained involvement by experienced and new contributors.

Discussion

  • 610 contributors had accepted more than 19,000 commits, while the source website drew roughly 20,000 unique visitors from May 14–27, 2018.GitHub metrics also recorded 721 unique codebase clones over that roughly two-week period.Source: Discussion · p. 13
  • 13,096,468 PyPI downloads and 5,776,017 conda downloads in 2017 provide a lower bound on SciPy’s user downloads.PyPI and conda are only two of several popular installation methods.Source: Discussion · p. 13
  • 47% of machine learning projects on GitHub use SciPy, which is also used by LIGO/Virgo and shipped with macOS and Intel Distribution for Python.The SciPy website, used as the default citation in the absence of a peer-reviewed paper, has been cited more than 3,000 times.Source: Discussion · p. 13
  • SciPy’s community-maintained roadmap identifies improvement directions, while the project seeks more than its current 15 tutorial sections and modernization of low-level Cython code.One proposed modernization is migrating to typed memoryviews for handling NumPy arrays; the roadmap is summarized in Table 2.Source: Discussion · p. 13, Table 2 · p. 13
  • SciPy retains experienced contributors alongside new developers, helping preserve institutional memory and maintain quality as the project grows.The BDFL had contributed for more than 10 years, the Steering Council head was nearing an eleventh anniversary, and about six other active developers had contributed steadily for at least five years.Source: Discussion · p. 13

Data Availability

SciPy’s source code and most data generated for the study are publicly available through the SciPy GitHub repository, with some supporting materials hosted in other public repositories cited in the paper.

  • All SciPy source code and most study-generated data are available in the SciPy GitHub repository, while some supporting code and data are in other public repositories cited by the manuscript.Source: Data Availability · p. 14

Author Contributions Statement · Consortium

The statement identifies SciPy’s leadership and founders, credits manuscript preparation to a subset of authors, and notes that all authors contributed to the project and reviewed the manuscript.

Author Contributions Statement

Loading 1907.10121v1…