QuantEcon / QuantEcon/QuantEcon.py

MAINT: Code-hygiene quick wins: dead code, bare excepts, broken test block, comparison anti-patterns

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

Nobody has claimed this yet.

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

Description

Problem

Small, independent hygiene defects that don't merit separate issues:

  1. quantecon/util/common_messages.py — one message string, referenced nowhere, untouched since 2018, pointing to the defunct continuum.io downloads page. Delete.
  2. quantecon/__init__.py:9-13 — bare except: (catches KeyboardInterrupt/SystemExit during import) around import numba, discarding the original exception and raising a conda-specific message — wrong for pip users, and it hides the real traceback in the common numba/llvmlite ABI-mismatch case. Replace with except ImportError as e: raise ImportError(<pip-and-conda message>) from e, or delete the guard and let the natural ImportError speak. The file-level # flake8: noqa masks this today.
  3. quantecon/tests/test_quadsum.py:59-63 — nose-era __main__ block calling undefined names (test_simplesum, test_identitysum; dangling uncalled test_m_identitysum). Running the file directly raises NameError; the source of all 3 F821s in the package. Delete the block.
  4. Comparison anti-patterns: _dle.py:246 isinstance(...) == True; _dle.py:280 and util/notebooks.py:77 type(x) != np.ndarrayisinstance (deep DLE work stays in #844 — these lines needn't wait).
  5. quantecon/markov/tests/test_graph_tools.py:137 — bare except:except KeyError:.
  6. util/timing.py:247__exit__ binds exc_type, exc_val, exc_tb unused. game_theory/game_generators/__init__.py:6 — the package's lone import *; make it explicit.
Acceptance criteria
  • Full flake8 quantecon run reports zero F821/E722/E712/E721
  • common_messages.py gone; suite green; no behavior change anywhere else

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 the file and line references in quantecon/util/common_messages.py, quantecon/init.py, quantecon/tests/test_quadsum.py, _dle.py, util/notebooks.py, markov/tests/test_graph_tools.py, util/timing.py, and game_theory/game_generators/init.py. Run the affected tests and full flake8 quantecon; done means zero F821/E722/E712/E721, the unused message is gone, and the suite remains green without other behavior changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.