Skip to content

FIX: export solve_discrete_riccati_system from the quantecon namespace - #996

Open
jadhavgaurav wants to merge 1 commit into
QuantEcon:mainfrom
jadhavgaurav:fix-export-riccati-system
Open

jadhavgaurav wants to merge 1 commit into
QuantEcon:mainfrom
jadhavgaurav:fix-export-riccati-system

Conversation

@jadhavgaurav

@jadhavgaurav jadhavgaurav commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #987.

solve_discrete_riccati_system is documented under currentmodule:: quantecon in docs/source/tools/matrix_eqn.rst and is listed in the quantecon.matrix_eqn shim, but quantecon/__init__.py imported only solve_discrete_lyapunov and solve_discrete_riccati. So autodoc could not import it, and the advice in the shim's deprecation warning (from quantecon import solve_discrete_riccati_system) raised ImportError.

This PR takes the first fix suggested in the issue: import the function next to the other two in quantecon/__init__.py. The committed docs stub is used as it is.

Test: test_deprecated_matrix_eqn_names_are_exported_by_quantecon in quantecon/tests/test_matrix_eqn.py checks that every name in quantecon.matrix_eqn.__all__ is available from quantecon and is the same object as in quantecon._matrix_eqn. It fails without the import (AttributeError: module 'quantecon' has no attribute 'solve_discrete_riccati_system') and passes with it.

Checked locally on Python 3.13:

  • pytest quantecon gives 770 passed, 1 skipped.
  • flake8 --select=F401,F405,E231 quantecon is clean.
  • python qe_apidoc.py in docs/ leaves docs/source unchanged.

I did not build the Sphinx docs. The five other names the issue lists (ckron, gridmake, annotate_nodes, num_compositions_jit, simulate_linear_model) are not touched here, since exporting them is a separate API decision.

Assisted-by: Claude Code (Claude Sonnet 5.5)

The docs stub for `quantecon.matrix_eqn` documents
`solve_discrete_riccati_system` under `currentmodule:: quantecon`, but
`quantecon/__init__.py` did not import it, so autodoc could not find it and the
API docs had no entry. The deprecated `quantecon.matrix_eqn` shim also tells
users to write `from quantecon import solve_discrete_riccati_system`, which
raised ImportError.

Import it next to the other two matrix-equation solvers. A new test checks that
every name the shim exports is available from `quantecon`.

Fixes QuantEcon#987.

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.136%. remained the same — jadhavgaurav:fix-export-riccati-system into QuantEcon:main

@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @jadhavgaurav!

QuantEcon welcomes AI-assisted contributions under its Code of AI Use. Every pull request carries one Assisted-by: line, and this one does not yet, so two quick things, please:

  1. Add one line to the description above: Assisted-by: <tool> (<model>) if AI tools meaningfully contributed (for example Assisted-by: Claude Code (Claude Fable 5.1)), or Assisted-by: none if they did not.
  2. Reply here to confirm that a human chose the task, read the result, and will answer review on it.

This comment is posted on every external pull request that arrives without the line, so it is not a flag on yours. Nothing is blocked; a maintainer reads the reply.

@jadhavgaurav

Copy link
Copy Markdown
Contributor Author

Added the Assisted-by line to the description. Confirming that a human chose this task, read the change, and will answer review on it.

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

Labels

author-response Waiting on author response

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: solve_discrete_riccati_system is missing from the API docs, and its deprecation warning points to an import that fails

3 participants