QuantEcon / QuantEcon/QuantEcon.py
Use Mypy annotation for arguments and return type documentation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
Description
With Mypy, the types can be checked explicitly. While I think in Sphinx, the types are just strings? (E.g. https://quanteconpy.readthedocs.io/en/latest/game_theory/repeated_game.html#quantecon.game_theory.repeated_game.RepeatedGame)
Sphinx can be configured to accept Mypy annotation: https://github.com/agronholm/sphinx-autodoc-typehints.
With Mypy, the type annotation would be:
class RepeatedGame:
def __init__(self, stage_game: NormalFormGame, delta: float):
...
def equilibrium_payoffs(
self,
method: Optional[str]=None,
options: Optional[Dict[str, Any]]=None) -> None:
...
More example of Mypy annotations: https://github.com/projectmesa/mesa/blob/d376920146ca0ec422286cb8434d86b74e64b2fa/mesa/space.py. In particular https://github.com/projectmesa/mesa/blob/d376920146ca0ec422286cb8434d86b74e64b2fa/mesa/space.py#L191-L197.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RepeatedGame documentation example in game_theory.repeated_game and compare its argument and return-type presentation with the sphinx-autodoc-typehints guidance. Review the referenced Mesa annotations as a model; done means the relevant Python signatures use Mypy annotations and Sphinx displays those types consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100