Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds typing hints documentation #3514

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

flamiedev
Copy link

@flamiedev flamiedev commented Oct 17, 2024

What was wrong?

Related to Issue #1628
Closes #1628

How was it fixed?

Created a new web3.types.rst file in the docs to list all the possible type hints available in the types file.

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@flamiedev flamiedev marked this pull request as draft October 17, 2024 12:44
@pacrob
Copy link
Contributor

pacrob commented Oct 19, 2024

Hey @flamiedev , thanks for getting this started! I'd rather we went in an auto-generated direction, that way we don't have to remember to update across both places when changes happen in the future.

Just to get you started:

  1. Add types to docs/toc.rst, probably in the API section, under constants
...
.. toctree::
    :maxdepth: 1
    :caption: API

    web3.main
    web3.eth
    web3.beacon
    web3.net
    web3.geth
    web3.tracing
    web3.utils
    gas_price
    ens
    constants
    types
...
  1. Create docs/types.rst with the following in it:
Types
=====

.. automodule:: web3.types
    :members:

Then when you build the docs, you'll see all the classes from types.py in there. The initial request specifically mentions mappings, so I'd like to see the members of each of these TypedDicts, along with their types. I'm not sure how to pull those out directly, or you may just need to add docstrings to the classes themselves. Docstrings would be helpful to give a brief explanation of what each TypedDict is used for, especially if it's not clear from the name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for TypedDict return values of methods usable by 3rd parties
2 participants