Skip to content

Commit c81cf7e

Browse files
committed
Merge pull request QuantEcon#164 from QuantEcon/update-doc-api
Update readthedocs to include all files and new sub packages in quantecon
2 parents b4e3bcd + 450b08b commit c81cf7e

26 files changed

+262
-28
lines changed

docs/qe_apidoc.py

Lines changed: 116 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
######################
4040
## String Templates ##
4141
######################
42+
4243
module_template = """{mod_name}
4344
{equals}
4445
@@ -48,6 +49,15 @@
4849
:show-inheritance:
4950
"""
5051

52+
markov_module_template = """{mod_name}
53+
{equals}
54+
55+
.. automodule:: quantecon.markov.{mod_name}
56+
:members:
57+
:undoc-members:
58+
:show-inheritance:
59+
"""
60+
5161
model_module_template = """{mod_name}
5262
{equals}
5363
@@ -57,6 +67,33 @@
5767
:show-inheritance:
5868
"""
5969

70+
solow_model_module_template = """{mod_name}
71+
{equals}
72+
73+
.. automodule:: quantecon.models.solow.{mod_name}
74+
:members:
75+
:undoc-members:
76+
:show-inheritance:
77+
"""
78+
79+
random_module_template = """{mod_name}
80+
{equals}
81+
82+
.. automodule:: quantecon.random.{mod_name}
83+
:members:
84+
:undoc-members:
85+
:show-inheritance:
86+
"""
87+
88+
util_module_template = """{mod_name}
89+
{equals}
90+
91+
.. automodule:: quantecon.util.{mod_name}
92+
:members:
93+
:undoc-members:
94+
:show-inheritance:
95+
"""
96+
6097
all_index_template = """=======================
6198
QuantEcon documentation
6299
=======================
@@ -81,16 +118,24 @@
81118
QuantEcon documentation
82119
=======================
83120
84-
The `quantecon` python library is composed of two main section: models
85-
and tools. The models section contains implementations of standard
121+
The `quantecon` python library consists of a number of modules which
122+
includes economic models (models), markov chains (markov), random
123+
generation utilities (random), a collection of tools (tools),
124+
and other utilities (util) which are
125+
mainly used by developers internal to the package.
126+
127+
The models section, for example, contains implementations of standard
86128
models, many of which are discussed in lectures on the website `quant-
87129
econ.net <http://quant-econ.net>`_.
88130
89131
.. toctree::
90132
:maxdepth: 2
91133
134+
markov
92135
models
136+
random
93137
tools
138+
util
94139
95140
Indices and tables
96141
==================
@@ -147,46 +192,108 @@ def all_auto():
147192

148193

149194
def model_tool():
195+
# list file names with markov
196+
markov_files = glob("../quantecon/markov/[a-z0-9]*.py")
197+
markov = map(lambda x: x.split('/')[-1][:-3], markov_files)
198+
# Alphabetize
199+
markov.sort()
200+
150201
# list file names with models
151202
mod_files = glob("../quantecon/models/[a-z0-9]*.py")
152203
models = map(lambda x: x.split('/')[-1][:-3], mod_files)
153204
# Alphabetize
154205
models.sort()
155206

156-
# list file names of tools
207+
# list file names with models.solow
208+
solow_files = glob("../quantecon/models/solow/[a-z0-9]*.py")
209+
solow = map(lambda x: x.split('/')[-1][:-3], solow_files)
210+
# Alphabetize
211+
solow.sort()
212+
213+
# list file names with random
214+
random_files = glob("../quantecon/random/[a-z0-9]*.py")
215+
random = map(lambda x: x.split('/')[-1][:-3], random_files)
216+
# Alphabetize
217+
random.sort()
218+
219+
# list file names of tools (base level modules)
157220
tool_files = glob("../quantecon/[a-z0-9]*.py")
158221
tools = map(lambda x: x.split('/')[-1][:-3], tool_files)
159222
# Alphabetize
223+
tools.remove("version")
160224
tools.sort()
225+
226+
# list file names of utilities
227+
util_files = glob("../quantecon/util/[a-z0-9]*.py")
228+
util = map(lambda x: x.split('/')[-1][:-3], util_files)
229+
# Alphabetize
230+
util.sort()
161231

162-
for folder in ["models", "tools"]:
232+
for folder in ["markov","models","models/solow","random","tools","util"]:
163233
if not os.path.exists(source_join(folder)):
164234
os.makedirs(source_join(folder))
165235

236+
# Write file for each markov file
237+
for mod in markov:
238+
new_path = os.path.join("source", "markov", mod + ".rst")
239+
with open(new_path, "w") as f:
240+
equals = "=" * len(mod)
241+
f.write(markov_module_template.format(mod_name=mod, equals=equals))
242+
166243
# Write file for each model
167244
for mod in models:
168245
new_path = os.path.join("source", "models", mod + ".rst")
169246
with open(new_path, "w") as f:
170247
equals = "=" * len(mod)
171248
f.write(model_module_template.format(mod_name=mod, equals=equals))
172249

173-
# Write file for each tool
250+
# Write file for each model.solow
251+
for mod in solow:
252+
new_path = os.path.join("source", "models", "solow", mod + ".rst")
253+
with open(new_path, "w") as f:
254+
equals = "=" * len(mod)
255+
f.write(solow_model_module_template.format(mod_name=mod, equals=equals))
256+
257+
# Write file for each random file
258+
for mod in random:
259+
new_path = os.path.join("source", "random", mod + ".rst")
260+
with open(new_path, "w") as f:
261+
equals = "=" * len(mod)
262+
f.write(random_module_template.format(mod_name=mod, equals=equals))
263+
264+
# Write file for each tool (base level modules)
174265
for mod in tools:
175266
new_path = os.path.join("source", "tools", mod + ".rst")
176267
with open(new_path, "w") as f:
177268
equals = "=" * len(mod)
178269
f.write(module_template.format(mod_name=mod, equals=equals))
179270

271+
# Write file for each utility
272+
for mod in util:
273+
new_path = os.path.join("source", "util", mod + ".rst")
274+
with open(new_path, "w") as f:
275+
equals = "=" * len(mod)
276+
f.write(util_module_template.format(mod_name=mod, equals=equals))
277+
180278
# write (index|models|tools).rst file to include autogenerated files
181279
with open(source_join("index.rst"), "w") as index:
182280
index.write(split_index_template)
183281

282+
mark = "markov/" + "\n markov/".join(markov)
184283
mods = "models/" + "\n models/".join(models)
284+
mods = mods + "\n solow/" #Add solow sub directory to models
285+
rand = "random/" + "\n random/".join(random)
185286
tlz = "tools/" + "\n tools/".join(tools)
186-
toc_tree_list = {"models": mods,
187-
"tools": tlz}
188-
189-
for f_name in ("models", "tools"):
287+
utls = "util/" + "\n util/".join(util)
288+
#-TocTree-#
289+
toc_tree_list = {"markov":mark,
290+
"models": mods,
291+
"tools": tlz,
292+
"random":rand,
293+
"util":utls,
294+
}
295+
296+
for f_name in ("markov","models","random","tools","util"):
190297
with open(source_join(f_name + ".rst"), "w") as f:
191298
temp = split_file_template.format(name=f_name.capitalize(),
192299
equals="="*len(f_name),

docs/source/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ def __getattr__(cls, name):
105105
# built documents.
106106
#
107107
# The short X.Y version.
108-
version = '0.1.3'
108+
from version import version as quantecon_version
109+
version = quantecon_version
109110
# The full version, including alpha/beta/rc tags.
110-
release = '0.1.3'
111+
release = quantecon_version
111112

112113
# The language for content autogenerated by Sphinx. Refer to documentation
113114
# for a list of supported languages.

docs/source/index.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
QuantEcon documentation
33
=======================
44

5-
The `quantecon` python library is composed of two main section: models
6-
and tools. The models section contains implementations of standard
5+
The `quantecon` python library consists of a number of modules which
6+
includes economic models (models), markov chains (markov), random
7+
generation utilities (random), a collection of tools (tools),
8+
and other utilities (util) which are
9+
mainly used by developers internal to the package.
10+
11+
The models section, for example, contains implementations of standard
712
models, many of which are discussed in lectures on the website `quant-
813
econ.net <http://quant-econ.net>`_.
914

1015
.. toctree::
1116
:maxdepth: 2
1217

18+
markov
1319
models
20+
random
1421
tools
22+
util
1523

1624
Indices and tables
1725
==================

docs/source/markov.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Markov
2+
======
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
markov/approximation
8+
markov/core
9+
markov/gth_solve
10+
markov/random

docs/source/markov/approximation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
approximation
2+
=============
3+
4+
.. automodule:: quantecon.markov.approximation
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
tauchen
2-
=======
1+
core
2+
====
33

4-
.. automodule:: quantecon.tauchen
4+
.. automodule:: quantecon.markov.core
55
:members:
66
:undoc-members:
77
:show-inheritance:

docs/source/markov/gth_solve.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
gth_solve
2+
=========
3+
4+
.. automodule:: quantecon.markov.gth_solve
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/markov/random.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
random
2+
======
3+
4+
.. automodule:: quantecon.markov.random
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/models.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Models
1111
models/lucastree
1212
models/odu
1313
models/optgrowth
14+
solow/

docs/source/models/solow/ces.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ces
2+
===
3+
4+
.. automodule:: quantecon.models.solow.ces
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cobb_douglas
2+
============
3+
4+
.. automodule:: quantecon.models.solow.cobb_douglas
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
impulse_response
2+
================
3+
4+
.. automodule:: quantecon.models.solow.impulse_response
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/models/solow/model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
model
2+
=====
3+
4+
.. automodule:: quantecon.models.solow.model
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/random.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Random
2+
======
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
random/utilities

docs/source/random/utilities.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
utilities
2+
=========
3+
4+
.. automodule:: quantecon.random.utilities
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/tools.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,26 @@ Tools
55
:maxdepth: 2
66

77
tools/arma
8-
8+
tools/cartesian
99
tools/ce_util
10+
tools/common_messages
1011
tools/compute_fp
1112
tools/discrete_rv
1213
tools/distributions
1314
tools/ecdf
1415
tools/estspec
16+
tools/external
1517
tools/graph_tools
1618
tools/gridtools
17-
tools/gth_solve
1819
tools/ivp
1920
tools/kalman
2021
tools/lae
2122
tools/lqcontrol
2223
tools/lqnash
2324
tools/lss
2425
tools/matrix_eqn
25-
tools/mc_tools
2626
tools/quad
2727
tools/quadsums
2828
tools/rank_nullspace
2929
tools/robustlq
30-
tools/tauchen
31-
tools/version
30+
tools/timing

docs/source/tools/cartesian.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
gridtools
1+
cartesian
22
=========
33

4-
.. automodule:: quantecon.gridtools
4+
.. automodule:: quantecon.cartesian
55
:members:
66
:undoc-members:
77
:show-inheritance:

docs/source/tools/common_messages.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common_messages
2+
===============
3+
4+
.. automodule:: quantecon.common_messages
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
mc_tools
1+
external
22
========
33

4-
.. automodule:: quantecon.mc_tools
4+
.. automodule:: quantecon.external
55
:members:
66
:undoc-members:
77
:show-inheritance:

0 commit comments

Comments
 (0)