Skip to content

ENH: Slim the mandatory dependency set: sympy and requests #880

Description

@mmcky

Problem

Two of our five runtime dependencies serve one peripheral call site each, and both imports are already function-local:

  • sympy (heavy; pulls mpmath, roughly 40 MB) is imported once, lazily, at quad.py:171, to run sym.primerange(0, 7920) — the first 1,000 primes for Weyl/Haber equidistributed sequences in qnwequi, and only when the caller didn't pass equidist_pp.
  • requests serves only util/notebooks.py::fetch_nb_dependencies, the notebook support-file downloader.

Every pip install quantecon pays both costs; neither touches the numerical core. Because the imports are already lazy, moving them behind extras is close to mechanical.

Proposed change

  • sympy: replace the call with a ~10-line sieve or a hardcoded constant array (the primes are fixed; regression-test the first/last values against the sympy output) and drop the dependency entirely. Fallback option: an extras group quantecon[quad] with a clear ImportError message.
  • requests: move to an extras group (quantecon[notebooks]) with a lazy import and actionable error — or, if fetch_nb_dependencies has no remaining constituency, fold its retirement into the Deprecate tic,tac, toc timers #786 utility-deprecation conversation (weigh the open fix issue for that function first).

Acceptance criteria

  • Fresh-venv pip install quantecon no longer installs sympy (and, per decision, requests); import quantecon and the full suite green in that venv
  • qnwequi output unchanged (regression test on default equidist_pp)
  • Changelog notes the lighter footprint and any new extras

From the July 2026 technical-debt audit (AI-assisted; claims verified against 28d4b3b on 2026-07-25).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions