Repository navigation
Documentation: front page and pages beyond the API reference #26
rahulsavani
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@nataliemes @stengel now that the docstring PRs (#19, #20, #24) are merged, here are some suggestions for the next step: a proper front page and some pages beyond the API reference. Comments, disagreements and additions very welcome. Once we agree, we can turn the pages into issues.
Current state
The documentation at https://gambitproject.readthedocs.io/projects/lemke/en/latest/ is built from
mainby Read the Docs. It has two parts:lemke.lemke,lemke.bimatrix,lemke.randomstart,lemke.utils,lemke.columnprint).A newcomer gets no worked example, no description of the input file formats, no command-line usage and no explanation of the algorithms. The file formats are the biggest gap: at the moment you can only work them out by reading the
from_filedocstrings or the bare files inexamples/.A new front page (
index.rst)The front page should stay short and lead the reader somewhere. Suggested contents:
What it is and who it's for. A pure Python implementation using exact rational arithmetic, built for teaching and research, where you want to see each pivot. Mention the link to Gambit and to Bernhard von Stengel's work.
Feature bullets:
d;lemke,bimatrixandrandomstart.A 30-second example in two parts:
z = (1/3, 1/3));bimatrix lh examples/gameon the command line, with its output.Installation. Say plainly that the package is not on PyPI and needs Python 3.10 or later. The install command is:
Links to the sections below. The pydata theme can show these as cards using
sphinx-design, which would be a new docs dependency.Author, how to cite, and licence (GPL-3.0).
New pages, in priority order
1. Getting started (tutorial)
LcpResult:success,z,w, and what ray termination means.PrintingCallbackto watch the pivots.2. File formats (reference)
This is the most needed page. Getting these details right in the docstrings took two rounds of fixes, which shows how easy they are to get wrong. It should cover:
n=, thenM=with the entries given row by row, thenq=andd=.m n, then the entries of A, then the entries of B.p/q, or decimals, and how the--decimalsoption rounds decimals.#,%or*are ignored. A#in the middle of a line does not start a comment.examples/.3. Command-line reference
Generate it from the Click definitions with
sphinx-click, so it can never drift from the code. Then add explanations by hand for things--helpcan't show:--labelsrange syntax, e.g.1,3-5,7-;basis=/z=/w=lines, "supports" and "found by labels".4. Background and theory
@stengel is the natural author for this page. Suggested topics:
z0and covering vectord;createLCPbuilds);Sphinx's built-in
mathjaxextension handles the mathematics.5. Worked examples
examples/game. This makes a good teaching point:bimatrix lhfinds only the two pure equilibria and misses the mixed one, x = (7/9, 2/9), y = (2/5, 3/5).randomstartplot, with the image generated when the docs are built.6. Extensive-form games via the sequence form
tests/sequence_form_helper.pyalready builds sequence-form LCPs from Gambit games. That is a strong use case, but at the moment it exists only as test code. We need to decide whether to move it into the package before documenting it.7. Contributing
pip install -e ".[test,dev,doc]". The-e(editable) matters: with a normal install, the tests run against an old copy of the code instead ofsrc/.pre-commit, running the tests, and building the docs locally withsphinx-autobuild.maininto a branch, checkgit diff main...HEADafterwards to make sure the merge didn't undo changes frommain.Configuration and housekeeping
pytest --doctest-modulesorsphinx.ext.doctest. Broken examples turned up in both docstring PRs (Add docstrings tolemke.pyandbimatrix.py#19 and Add docstrings torandomstart.py#20). The examples that read"lcp.txt"or"game.txt"would need small fixture files.intersphinxso that types such asfractions.Fractionandnumpy.ndarraylink to the Python and NumPy documentation.undoc-membersinconf.py. At the moment every internal helper appears in the API reference.versionandreleaseinconf.pyfrom the package metadata.examples/game, the comment# max= 4for B is wrong: B's largest entry is 7.--decimalshelp text of thelemkecommand says "payoff digits", but an LCP has no payoffs.Suggested order of work
sphinx-clickis mostly mechanical.All reactions