Repository navigation
Add library usage tutorials in docs - #30
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Default doctest collection includes API examples with missing input files, causing the doctest build to fail.
4 open issues
What changed in this PR
Adds library-focused tutorials alongside the API documentation, covering LCP solving, bimatrix equilibria, and random-prior visualization.
Changes:
- Adds three tutorials and documentation navigation.
- Enables doctests and embedded plots.
- Adjusts output formatting and callback stream initialization.
| File | Description |
|---|---|
| src/lemke/lemke.py | Resolves default stdout when constructing callbacks. |
| src/lemke/columnprint.py | Removes trailing output whitespace. |
| examples/lcp_2x2 | Adds tutorial input data. |
| doc/tutorials/randomstart.rst | Explains simplex sampling and visualization. |
| doc/tutorials/lcp.rst | Demonstrates solving LCPs and using callbacks. |
| doc/tutorials/index.rst | Organizes tutorial navigation. |
| doc/tutorials/bimatrix.rst | Demonstrates equilibrium-finding methods. |
| doc/index.rst | Links tutorials from the documentation homepage. |
| doc/conf.py | Enables doctests and configures plots. |
Review effort: Balanced
rahulsavani
requested changes
Oct 21, 2026
rahulsavani
left a comment
Member
There was a problem hiding this comment.
Again, this looks good to me, just a few thing copilot picked up to deal with.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
# Conflicts: # doc/index.rst
# Conflicts: # doc/index.rst
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
rahulsavani
approved these changes
Oct 24, 2026
rahulsavani
left a comment
Member
There was a problem hiding this comment.
Looks good to me, I just made one minor edit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Main changes
#26 mentioned two separate pages: getting started (tutorials) and worked examples, but since they had overlapping content, I decided to make one dedicated place for tutorials. There are three new tutorial pages for:
randomstartmodule).You can view them here.
Also, I thought the CLI examples should be included in the CLI page (which I will add shortly), therefore these tutorials show only the library usage examples.
Let me know if you think another way of organizing examples/tutorials is better.
Other related changes
columnprint.pywas updated to strip the whitespaces at the end of the strings.lemke.py, thePrintingCallbackconstructor usedstream=sys.stdoutas a default argument. Python evaluates defaults once at definition time, so the callback kept a reference to the originalstdoutfrom import time. Anything that later replacedsys.stdout(like doctest) was silently bypassed, so the output reached the real console but was not captured, therefore doctests saw empty output.The default was changed to
Noneandsys.stdoutis resolved when the stream is used (so the currentsys.stdoutis respected).