QuantEcon / QuantEcon/QuantEcon.py
Six objects in the deprecated shims' __all__ are missing from the top-level quantecon namespace
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
Description
Summary
While refreshing the API-reference docs in #850, I found that six objects are listed in the deprecated compatibility shims' __all__ but were never re-exported into the top-level quantecon namespace. As a result, from quantecon import <name> raises ImportError for these six today — even though each shim's own DeprecationWarning explicitly tells users to import them "from the quantecon namespace."
The six objects
| Object | Shim (in its __all__) |
Implementation module | Re-exported in quantecon/__init__.py? |
|---|---|---|---|
ckron |
quantecon.ce_util |
_ce_util |
No |
gridmake |
quantecon.ce_util |
_ce_util |
No |
annotate_nodes |
quantecon.graph_tools |
_graph_tools |
No |
num_compositions_jit |
quantecon.gridtools |
_gridtools |
No |
simulate_linear_model |
quantecon.lss |
_lss |
No |
solve_discrete_riccati_system |
quantecon.matrix_eqn |
_matrix_eqn |
No |
The curation looks deliberate — sibling objects in the same modules are promoted while these are not: LinearStateSpace but not simulate_linear_model; solve_discrete_riccati but not solve_discrete_riccati_system; num_compositions but not num_compositions_jit. _ce_util is not imported into __init__.py at all. There is even a #->Propose Delete From Top Level block in __init__.py, so the top-level surface has clearly been managed by hand.
Why it matters
1. The deprecation guidance is currently broken for these six. Accessing one through its shim, e.g. quantecon.lss.simulate_linear_model, emits:
Please use
simulate_linear_modelfrom thequanteconnamespace, thequantecon.lssnamespace is deprecated. You can use the following instead:from quantecon import simulate_linear_model.
…but from quantecon import simulate_linear_model then raises ImportError. A user who follows the warning hits a dead end. This is independent of the docs — it's a package-level inconsistency.
2. It surfaced as a docs question in #850. That PR moves the base-level API pages from documenting the deprecated shim / private module to documenting the public objects in the quantecon namespace. Because these six aren't in that namespace, they can't be documented as quantecon.<name>. For reference, how each version represents them:
| Version | Rendered heading for these six |
|---|---|
Published latest (main) |
quantecon.lss.simulate_linear_model, quantecon.ce_util.ckron, … (deprecated shim namespace) |
| #850 head, earlier commit | quantecon._lss.simulate_linear_model, … (private implementation module) |
| #850 head, current commit | dropped from the docs (they don't resolve as quantecon.<name>) |
Options (from the #850 discussion)
- Promote to
quantecon.*— add the six toquantecon/__init__.py. The docs then renderquantecon.simulate_linear_modeletc. cleanly and consistently, and the shims' "import from thequanteconnamespace" guidance finally works. This expands the public API surface by six names. - Document via the implementation module — the docs generator falls back to
quantecon._lss.simulate_linear_modelfor just these six. No API change and nothing is dropped, but those six pages show a private_moduleheading. - Omit from the API reference — treat all six as internal. Cleanest public reference and no API change, but drops six functions that the currently-published docs still show.
For discussion
A per-object call may make sense rather than one blanket choice — e.g. num_compositions_jit reads as a deliberately-internal numba-jitted variant of the public num_compositions and is a natural "keep internal", whereas simulate_linear_model and solve_discrete_riccati_system look like reasonable public functions whose omission may simply be an oversight.
Whatever we decide, two cleanups fall out of it:
- Reconcile each shim's
__all__(and its deprecation message) with whatever the top-level namespace actually exports, so the guidance stops pointing at imports that don't exist. - #850 should not merge while it silently drops these six; the resolution here unblocks it.
Raised so the team can weigh in — happy to implement whichever direction we land on. Related: #850, #852.
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 quantecon/init.py and the deprecated shims named in the issue, comparing their all entries and deprecation guidance with the top-level exports. Review the linked #850 discussion and the six objects' implementation modules before choosing whether each should be promoted, documented privately, or removed from the shim surface. Done means the chosen policy is consistent and #850 no longer drops or misdirects these names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100