Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,48 @@ jobs:
file: coverage.lcov
format: lcov

docs:

name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
# mirrors the Read the Docs build (see .readthedocs.yaml)
python-version: "3.14"
- name: Install dependencies
run: |
pip install -r docs/rtd-requirements.txt
pip install .
- name: Check generated sources are up to date
# Read the Docs builds the *committed* .rst files and never runs
# qe_apidoc.py, so regenerating here would pass green while RTD
# served stale pages. Fail if the committed sources have drifted.
working-directory: docs
run: python qe_apidoc.py
- name: Fail on docs/source drift
# Check for modified tracked files AND untracked new files: a
# newly added module makes qe_apidoc.py emit a new .rst, which
# `git diff` alone would miss.
run: |
git diff --exit-code -- docs/source \
|| { echo "::error::docs/source is stale -- run 'cd docs && python qe_apidoc.py' and commit the result"; exit 1; }
untracked=$(git ls-files --others --exclude-standard docs/source)
if [ -n "$untracked" ]; then
echo "::error::qe_apidoc.py generated new uncommitted pages: $untracked -- run 'cd docs && python qe_apidoc.py' and commit the result"
exit 1
fi
- name: Build HTML
working-directory: docs
run: sphinx-build -b html source build/html
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/build/html

publish:

name: Publish to PyPi
Expand Down
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ See [release notes](https://github.com/QuantEcon/QuantEcon.py/releases/tag/v0.11

See [release notes](https://github.com/QuantEcon/QuantEcon.py/releases/tag/v0.11.2)

## Ver 0.11.1 (4th-March-2026)
## Ver 0.11.1 (6th-March-2026)

See [release notes](https://github.com/QuantEcon/QuantEcon.py/releases/tag/v0.11.1)

## Ver 0.11.0
## Ver 0.11.0 (23rd-February-2026)

See [release notes](https://github.com/QuantEcon/QuantEcon.py/releases/tag/v0.11.0)

Expand Down Expand Up @@ -358,5 +358,5 @@ Contributors: [oyamad](https://github.com/oyamad), [QBatista](https://github.com

### Ver. 0.3

1. Removes ``quantecon/models`` subpackage and the collection of code examples. Code has been migrated to the [QuantEcon.applications](https://github.com/QuantEcon/QuantEcon.applications) repository.
2. Adds a utility for fetching notebook dependencies from [QuantEcon.applications](https://github.com/QuantEcon/QuantEcon.applications) to support community contributed notebooks.
1. Removes ``quantecon/models`` subpackage and the collection of code examples. Code has been migrated to the QuantEcon.applications (now removed) repository.
2. Adds a utility for fetching notebook dependencies from QuantEcon.applications (now removed) to support community contributed notebooks.
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A high performance, open source Python code library for economics
results = aiyagari_ddp.solve(method='policy_iteration')
```

[![Build Status](https://github.com/QuantEcon/QuantEcon.py/actions/workflows/ci.yml/badge.svg)](https://github.com/QuantEcon/QuantEcon.py/actions?query=workflow%3Abuild)
[![Build Status](https://github.com/QuantEcon/QuantEcon.py/actions/workflows/ci.yml/badge.svg)](https://github.com/QuantEcon/QuantEcon.py/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/QuantEcon/QuantEcon.py/badge.svg)](https://coveralls.io/r/QuantEcon/QuantEcon.py)
[![Documentation (stable)](https://img.shields.io/badge/docs-stable-blue.svg)](https://quanteconpy.readthedocs.io/en/stable/)
[![Documentation (latest)](https://img.shields.io/badge/docs-latest-blue.svg)](https://quanteconpy.readthedocs.io/en/latest/)
Expand Down Expand Up @@ -42,15 +42,15 @@ You can check the version by running
print(qe.__version__)
```

If your version is below what’s available on [PyPI](https://pypi.python.org/pypi/quantecon/) then it is time to upgrade. This can be done by running
If your version is below what’s available on [PyPI](https://pypi.org/project/quantecon/) then it is time to upgrade. This can be done by running

pip install --upgrade quantecon

## Examples and Sample Code

Many examples of QuantEcon.py in action can be found at [Quantitative Economics](https://lectures.quantecon.org/). See also the
Many examples of QuantEcon.py in action can be found at [Quantitative Economics](https://quantecon.org/lectures/). See also the

* [Documentation](https://quanteconpy.readthedocs.org/en/latest/)
* [Documentation](https://quanteconpy.readthedocs.io/en/latest/)
* [Notebook gallery](https://github.com/QuantEcon/notebook-gallery)

QuantEcon.py is supported financially by the [Alfred P. Sloan Foundation](http://www.sloan.org/) and is part of the [QuantEcon organization](https://quantecon.org).
Expand All @@ -63,10 +63,10 @@ An alternative is to download the sourcecode of the `quantecon` package and in

Once you have downloaded the source files then the package can be installed by running

pip install flit
flit install
cd QuantEcon.py
pip install .

(To learn the basics about setting up Git see [this link](https://help.github.com/articles/set-up-git/).)
(To learn the basics about setting up Git see [this link](https://docs.github.com/en/get-started/git-basics/set-up-git).)

## Citation

Expand All @@ -77,13 +77,14 @@ A BibTeX entry for LaTeX users is
```bibtex
@article{10.21105/joss.05585,
author = {Batista, Quentin and Coleman, Chase and Furusawa, Yuya and Hu, Shu and Lunagariya, Smit and Lyon, Spencer and McKay, Matthew and Oyama, Daisuke and Sargent, Thomas J. and Shi, Zejin and Stachurski, John and Winant, Pablo and Watkins, Natasha and Yang, Ziyue and Zhang, Hengcheng},
doi = {10.5281/zenodo.10345102},
doi = {10.21105/joss.05585},
title = {QuantEcon.py: A community based Python library for quantitative economics},
year = {2024},
journal = {Journal of Open Source Software},
volume = {9},
number = {93},
pages = {5585}
pages = {5585},
url = {https://joss.theoj.org/papers/10.21105/joss.05585}
}
```

Expand Down
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ srcclean:
rm -f source/game_theory.rst
rm -rf source/markov
rm -f source/markov.rst
rm -rf source/optimize
rm -f source/optimize.rst
rm -rf source/random
rm -f source/random.rst
rm -rf source/timings
rm -f source/timings.rst
rm -rf source/util
rm -f source/util.rst

Expand Down
33 changes: 5 additions & 28 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,23 @@ This is the main directory for the documentation for the `quantecon` python libr

## Dependencies

The documentation requires a few dependencies beyond those necessary for the quantecon library. These dependencies are (warning, this may be an incomplete list):

* sphinx
* numpydoc
* sphinx_rtd_theme
* mock

You can install these by executing
The documentation requires a few dependencies beyond those necessary for the quantecon library. The full documentation dependency set is listed in `rtd-requirements.txt` (this is what Read the Docs installs, see `.readthedocs.yaml` at the repository root). Install it with:

```
conda install sphinx numpydoc sphinx_rtd_theme mock
pip install -r rtd-requirements.txt
```

## Building the docs

In order to generate the documentation, follow these steps:

1. Install the `quantecon` python library locally. Do to this enter the commands below:
1. Install the `quantecon` python library locally. To do this enter the commands below:
```
cd ..
pip install .
cd docs
```
2. From this directory, execute the local file `qe_apidoc.py` (for an explanation of what the file does, see the module level docstring in the file)
2. (Optional -- `make html` in the next step runs this automatically.) From this directory, execute the local file `qe_apidoc.py` (for an explanation of what the file does, see the module level docstring in the file)
```
python qe_apidoc.py
```
Expand All @@ -37,22 +30,6 @@ make html
```
4. Open the file `build/html/index.html`.

I have added a couple utility commands to the make file:

```
srcclean:
rm -rf source/modules*
rm -rf source/models*
rm -rf source/tools*
rm -f source/index.rst
rm -f source/models.rst
rm -f source/tools.rst

myhtml:
make srcclean
cd .. && pip install . && cd docs
python qe_apidoc.py
make html
```
I have added a couple utility commands to the make file. `make srcclean` deletes the `source/` subdirectories and `.rst` files generated by `qe_apidoc.py`; `make myhtml` chains srcclean + reinstall + apidoc + html, automating steps 1-3 above. See the `srcclean` and `myhtml` targets in `docs/Makefile` for the exact list of paths.

Notice that we can automate steps 1-3 (and make sure we get a clean build) above by simply running `make myhtml`
85 changes: 56 additions & 29 deletions docs/qe_apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
This file should be called from the command line. It accepts one
additional command line parameter. If we pass the parameter `single`
when running the file, this file will create a single directory named
modules where each module in quantecon will be documented. The index.rst
file will then contain a single list of all modules.

If no argument is passed or if the argument is anything other than
`single`, two directories will be created: models and tools. The models
directory will contain documentation instructions for the different
models in quantecon, whereas the tools directory will contain docs for
the tools in the package. The generated index.rst will then contain
two toctrees, one for models and one for tools.
modules where only the base-level modules of quantecon are documented.
The index.rst file will then contain a single list of those modules;
the subpackages (game_theory, markov, optimize, random, timings, util)
are omitted, and setup/contributing are left out of the toctree. This
mode is not used by `make html`.

If no argument is passed, or if the argument is anything other than
`single`, one directory is created per subpackage (game_theory,
markov, optimize, random, timings, util) plus a `tools` directory for
the base-level modules, and a top-level .rst per section. The
generated index.rst then contains a single toctree listing setup, each
section, and contributing.

Examples
--------
$ python qe_apidoc.py # generates the two separate directories
$ python qe_apidoc.py foo_bar # generates the two separate directories
$ python qe_apidoc.py # generates the per-section directories
$ python qe_apidoc.py foo_bar # generates the per-section directories
$ python qe_apidoc.py single # generates the single directory


Expand All @@ -30,9 +33,6 @@
To do this, use one of the commands above and replace `python` with
`%%run`

2. Models has been removed. But leaving infrastructure here for qe_apidoc
in the event we need it in the future


"""
import ast
Expand Down Expand Up @@ -128,6 +128,15 @@
:show-inheritance:
"""

timings_module_template = """{mod_name}
{equals}

.. automodule:: quantecon.timings.{mod_name}
:members:
:undoc-members:
:show-inheritance:
"""

all_index_template = """=======================
QuantEcon documentation
=======================
Expand Down Expand Up @@ -155,8 +164,10 @@
The `quantecon` python library consists of a number of modules which
includes game theory (game_theory), markov chains (markov),
optimization algorithms (optimize), random generation utilities
(random), a collection of tools (tools), and other utilities (util)
which are mainly used by developers internal to the package.
(random), global timing-precision configuration (timings), a collection
of tools (tools), and other utilities (util), which include user-facing
timing tools (``Timer``, ``timeit``) alongside helpers used internally
by the package.

.. toctree::
:maxdepth: 2
Expand All @@ -166,6 +177,7 @@
markov
optimize
random
timings
tools
util
contributing
Expand Down Expand Up @@ -341,7 +353,16 @@ def model_tool():
# Alphabetize
util.sort()

for folder in ["game_theory", "markov", "optimize", "random", "tools", "util"]:
# list file names with timings
timings_files = glob("../quantecon/timings/[a-z0-9]*.py")
timings = list(map(lambda x: x.split('/')[-1][:-3], timings_files))
# Alphabetize
timings.sort()

for folder in ["game_theory",
os.path.join("game_theory", "game_generators"),
"markov", "optimize", "random", "timings", "tools",
"util"]:
if not os.path.exists(source_join(folder)):
os.makedirs(source_join(folder))

Expand Down Expand Up @@ -395,14 +416,22 @@ def model_tool():
equals = "=" * len(mod)
f.write(util_module_template.format(mod_name=mod, equals=equals))

# write (index|models|tools).rst file to include autogenerated files
# Write file for each timings module
for mod in timings:
new_path = os.path.join("source", "timings", mod + ".rst")
with open(new_path, "w") as f:
equals = "=" * len(mod)
f.write(timings_module_template.format(mod_name=mod, equals=equals))

# write index.rst plus one .rst per section to include autogenerated files
with open(source_join("index.rst"), "w") as index:
index.write(split_index_template)

gt = "game_theory/" + "\n game_theory/".join(game_theory)
mark = "markov/" + "\n markov/".join(markov)
opti = "optimize/" + "\n optimize/".join(optimize)
rand = "random/" + "\n random/".join(random)
tmgs = "timings/" + "\n timings/".join(timings)
tlz = "tools/" + "\n tools/".join(tools)
utls = "util/" + "\n util/".join(util)
#-TocTree-#
Expand All @@ -411,21 +440,19 @@ def model_tool():
"optimize" : opti,
"tools": tlz,
"random": rand,
"timings": tmgs,
"util": utls,
}

for f_name in ("game_theory", "markov", "optimize", "random", "tools", "util"):
for f_name in ("game_theory", "markov", "optimize", "random", "timings",
"tools", "util"):
with open(source_join(f_name + ".rst"), "w") as f:
m_name = f_name
if f_name == "game_theory":
f_name = "Game Theory" #Produce Nicer Title for Game Theory Module
if f_name == "util":
f_name = "Utilities" #Produce Nicer Title for Utilities Module
if f_name == "optimize":
f_name = "Optimize"
temp = split_file_template.format(name=f_name.capitalize(),
equals="="*len(f_name),
files=toc_tree_list[m_name])
#Produce Nicer Titles for the multi-word/abbreviated sections
title = {"game_theory": "Game Theory",
"util": "Utilities"}.get(f_name, f_name.capitalize())
temp = split_file_template.format(name=title,
equals="="*len(title),
files=toc_tree_list[f_name])
f.write(temp)

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion docs/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx<=6.2.1
sphinx
ipython
numpydoc
numba>=0.49
Expand Down
Loading
Loading