QuantEcon / QuantEcon/QuantEcon.py

RFC: gth_solve — consolidate or test the pure-Python fallback

Open
#887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
Python
Stars
2.4k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
3

Description

Problem

markov/gth_solve.py implements the GTH algorithm twice: the Numba-jitted _gth_solve_jit, and a pure-Python duplicate behind use_jit=False (lines 79–99). Coverage shows the file at 52% with exactly the fallback untested — the classic dual-implementation trap: the untested twin silently diverges from the tested one.

Proposed change

Pick one:

A (preferred): delete the pure-Python branch and the use_jit parameter (with a deprecation cycle if it counts as documented API — it appears in the signature docs). Numba is a hard dependency; a no-numba escape hatch that is never exercised protects nobody.

B: keep it, and parametrize the existing gth_solve tests over use_jit=[True, False] so both paths are pinned to identical outputs.

Related context: #480 (repeated logic).

Acceptance criteria
  • markov/gth_solve.py coverage ≳95%, or the fallback is gone
  • If A: use_jit removal noted in the changelog with a deprecation-path decision

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with markov/gth_solve.py, especially the _gth_solve_jit implementation, the pure-Python branch at lines 79–99, and the existing gth_solve tests. Resolve whether to remove the fallback and use_jit or parameterize tests over use_jit=[True, False]; completion requires the stated coverage target or fallback removal, with any use_jit API decision recorded in the changelog.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.