QuantEcon / QuantEcon/QuantEcon.py
ENH: Slim the mandatory dependency set: sympy and requests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
Description
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, atquad.py:171, to runsym.primerange(0, 7920)— the first 1,000 primes for Weyl/Haber equidistributed sequences inqnwequi, and only when the caller didn't passequidist_pp.requestsserves onlyutil/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 groupquantecon[quad]with a clearImportErrormessage.requests: move to an extras group (quantecon[notebooks]) with a lazy import and actionable error — or, iffetch_nb_dependencieshas no remaining constituency, fold its retirement into the #786 utility-deprecation conversation (weigh the open fix issue for that function first).
Acceptance criteria
- Fresh-venv
pip install quanteconno longer installs sympy (and, per decision, requests);import quanteconand the full suite green in that venv -
qnwequioutput unchanged (regression test on defaultequidist_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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lazy import and prime generation at quad.py:171, then inspect util/notebooks.py::fetch_nb_dependencies and the open #786 utility-deprecation discussion before choosing the requests path. Verify the packaging metadata and run a fresh-venv install, the full suite, and qnwequi regression coverage; done means the unnecessary runtime dependencies are absent or isolated in documented extras and the changelog is updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100