ETH_TYPING(1)

NAME
eth_typing - eth-typing Documentation

Common type annotations for ethereum python packages.

INSTALLATION

    python -m pip install eth-typing

  Types

The following types are available from the eth_typing module.

i.e.

    from eth_typing import TypeStr

  Application Binary Interface

  BLS

  Discovery

  Encoding

  Enums

  EVM

  Exceptions

  Networks

  Release Notes

  eth-typing v5.2.1 (2025-04-14)

  Bugfixes

•   Set name as optional for ABIComponent type. (#95 <https://github.com/ethereum/eth-typing/issues/95>)

  eth-typing v5.2.0 (2025-02-20)

  Features

•   Add Prague to ForkName enum (#94 <https://github.com/ethereum/eth-typing/issues/94>)

  eth-typing v5.1.0 (2025-01-08)

  Features

•   Add py313 support, drop bumpmyversion in favor of bump-my-version (#93 <https://github.com/ethereum/eth-typing/issues/93>)

  eth-typing v5.0.1 (2024-10-14)

  Bugfixes

•   ABIEvent should use ABIComponentIndexed instead of ABIComponent as the type for inputs. (#92 <https://github.com/ethereum/eth-typing/issues/92>)

  eth-typing v5.0.0 (2024-08-14)

  Internal Changes - for eth-typing Contributors

•   Run mypy locally rather than in a pre-commit container (#90 <https://github.com/ethereum/eth-typing/issues/90>)

  eth-typing v5.0.0-beta.3 (2024-06-27)

  Features

•   Replace ABIFunctionInfo type with ABIElementInfo to encompass all ABIElement types. ABIElementInfo includes the function abi (ABIElement), selector (HexStr) and args (Tuple). (#85 <https://github.com/ethereum/eth-typing/issues/85>)

  Internal Changes - for eth-typing Contributors

•   Cleanup references to ABI types that have been removed. (#87 <https://github.com/ethereum/eth-typing/issues/87>)

  eth-typing v5.0.0-beta.2 (2024-06-18)

  Improved Documentation

•   Updates all modules and types with docstrings. Docs are now generated through autodoc. (#81 <https://github.com/ethereum/eth-typing/issues/81>)

  Features

•   Move URI type from EthPM module to networks. (#65 <https://github.com/ethereum/eth-typing/issues/65>)

  Removals

•   Remove types related to the EthPM module which has been removed from web3.py (#65 <https://github.com/ethereum/eth-typing/issues/65>)

•   Remove deprecated ABI types ABIEventComponent, ABIEventParam, ABIFunctionComponent, ABIFunctionParam. (#82 <https://github.com/ethereum/eth-typing/issues/82>)

  eth-typing v5.0.0-beta.1 (2024-06-17)

  Breaking changes

•   Mark ABI types with optional attributes.

•   ABIFunction requires type and name but inputs and outputs are optional.

•   ABIEvent requires type and name but inputs and anonymous are optional.

•   All attributes of ABIFunctionInfo are required.

•   ABIFallback and ABIReceive now require the type attribute.

•   ABIConstructor requires a type but inputs are optional.

•   ABIError requires type and name but inputs is optional.

•   ABIComponent requires type and name but components may be omitted so that inputs may use either primitive or tuple types. (#76 <https://github.com/ethereum/eth-typing/issues/76>) (#79 <https://github.com/ethereum/eth-typing/issues/79>)

  eth-typing v4.3.1 (2024-06-17)

  Bugfixes

•   Update typing_extensions to 4.5.0 which supposrts deprecated decorator. (#80 <https://github.com/ethereum/eth-typing/issues/80>)

  eth-typing v4.3.0 (2024-06-10)

  Deprecations

•   Mark EthPM types as deprecated in the docs. (#67 <https://github.com/ethereum/eth-typing/issues/67>)

•   Deprecated ABIEventComponent, ABIEventParam, ABIFunctionComponent and ABIFunctionParam for removal in v5. (#74 <https://github.com/ethereum/eth-typing/issues/74>)

  Features

•   Add ABIError TypedDict for ABI error messages and ABIComponent TypedDict for ABI type components. (#73 <https://github.com/ethereum/eth-typing/issues/73>)

•   ABIComponentIndexed now extends ABIComponent to support the indexed property. (#74 <https://github.com/ethereum/eth-typing/issues/74>)

•   Added ABIError, ABIFallback and ABIReceive types to ABIFunctionInfo.abi types. ABICallable is now a type alias for Union[ABIFunctionInfo, ABIError, ABIFallback, ABIReceive]. (#77 <https://github.com/ethereum/eth-typing/issues/77>)

  eth-typing v4.2.3 (2024-05-06)

  Features

•   Update networks types with the latest. (#72 <https://github.com/ethereum/eth-typing/issues/72>)

  eth-typing v4.2.2 (2024-04-29)

  Bugfixes

•   Fixes types that were incorrectly defined for ABI utils. (#62 <https://github.com/ethereum/eth-typing/issues/62>)

  Features

•   Update network type mappings. (#70 <https://github.com/ethereum/eth-typing/issues/70>)

  Miscellaneous Changes

•   #68 <https://github.com/ethereum/eth-typing/issues/68>

  eth-typing v4.2.1 (2024-04-16)

  Bugfixes

•   Put back types used for EthPM: ContractName, Manifest, and URI. (#64 <https://github.com/ethereum/eth-typing/issues/64>)

  eth-typing v4.2.0 (2024-04-15)

  Features

•   Add type definitions to represent contract ABI s. (#61 <https://github.com/ethereum/eth-typing/issues/61>)

  Removals

•   Remove types related to the EthPM module which has been removed from web3.py (#60 <https://github.com/ethereum/eth-typing/issues/60>)

  eth-typing v4.1.0 (2024-04-01)

  Features

•   Add python3.12 support (#57 <https://github.com/ethereum/eth-typing/issues/57>)

  Internal Changes - for eth-typing Contributors

•   Merge template updates, adding build tests for all docs formats, add blocklint to lint tools (#57 <https://github.com/ethereum/eth-typing/issues/57>)

  eth-typing v4.0.0 (2024-01-09)

  Breaking changes

•   Drop python 3.7 support (#55 <https://github.com/ethereum/eth-typing/issues/55>)

  Internal Changes - for eth-typing Contributors

•   Merge updates from the project template, notably: use pre-commit for linting and change the name of the master branch to main (#55 <https://github.com/ethereum/eth-typing/issues/55>)

•   Fixed booleans in pyproject.toml and added a test for the presence of the eth_typing.__version__ attribute (#56 <https://github.com/ethereum/eth-typing/issues/56>)

  eth-typing v3.5.2 (2023-11-07)

  Miscellaneous Changes

•   #54 <https://github.com/ethereum/eth-typing/issues/54>

  eth-typing v3.5.1 (2023-10-20)

  Internal Changes - for eth-typing Contributors

•   Add script to maintain Network constants listed in the networks module. (#51 <https://github.com/ethereum/eth-typing/issues/51>)

•   Add types-setuptools to support pkg_resources and __version__ (#52 <https://github.com/ethereum/eth-typing/issues/52>)

  eth-typing v3.5.0 (2023-09-29)

  Features

•   Borrowing from the typing in web3.py, open up BlockIdentifier to include BlockParams (e.g. "latest", "finalized", etc..) as well as other valid values. (#47 <https://github.com/ethereum/eth-typing/issues/47>)

•   Add an IntEnum class, ChainId, defining EVM-compatible network name enums as their respective chain id int values. (#49 <https://github.com/ethereum/eth-typing/issues/49>)

  Internal Changes - for eth-typing Contributors

•   Add the tests/ directory to the distributed tarball (#46 <https://github.com/ethereum/eth-typing/issues/46>)

•   Added build.os config for readthedocs (#48 <https://github.com/ethereum/eth-typing/issues/48>)

•   Fix release command by checking the git remote upstream configuration and merge other minor template updates. (#50 <https://github.com/ethereum/eth-typing/issues/50>)

  eth-typing v3.4.0 (2023-06-07)

  Improved Documentation

•   pull in ethereum-python-project-template updates (#44 <https://github.com/ethereum/eth-typing/issues/44>)

  Features

•   Add Cancun to ForkName enum. (#45 <https://github.com/ethereum/eth-typing/issues/45>)

  Internal Changes - for eth-typing Contributors

•   remove unused docs deps, bump version of remaining (#43 <https://github.com/ethereum/eth-typing/issues/43>)

•   pull in ethereum-python-project-template updates (#44 <https://github.com/ethereum/eth-typing/issues/44>)

•   For CircleCI builds, update pip and pip install tox under sys instead of --user to avoid virtualenv versioning issues. (#45 <https://github.com/ethereum/eth-typing/issues/45>)

  v3.3.0 (2023-03-08)

  Features

•   Add Shanghai to ForkName enum. (#39 <https://github.com/ethereum/eth-typing/issues/39>)

•   Add support for python 3.11. (#40 <https://github.com/ethereum/eth-typing/issues/40>)

  Internal Changes - for eth-typing Contributors

•   tox related updates for make docs to work properly. Remove some old references to python 3.5 and 3.6. (#39 <https://github.com/ethereum/eth-typing/issues/39>)

•   Bump mypy version to 0.910 to avoid issues installing the "[dev]" extra on Python 3.10. Update test suite to require installing the full dependency suite to help catch these errors. (#41 <https://github.com/ethereum/eth-typing/issues/41>)

  v3.2.0 (2022-09-14)

  Features

•   Add Merge to ForkName enum (#34 <https://github.com/ethereum/eth-typing/issues/34>)

  Bugfixes

•   Pin Python version to <4 instead of <3.11 (#37 <https://github.com/ethereum/eth-typing/issues/37>)

•   Rename Merge to Paris in ForkNameEnum (#38 <https://github.com/ethereum/eth-typing/issues/38>)

  v3.1.0 (2022-06-22)

  Features

•   Setup towncrier to generate release notes from fragment files to ensure a higher standard for release notes. (#16 <https://github.com/ethereum/eth-typing/issues/16>)

•   Add new BLSPrivateKey type for BLS private key (#23 <https://github.com/ethereum/eth-typing/issues/23>)

•   Add __all__ property to __init__.py with appropriate types to explicitly export (#28 <https://github.com/ethereum/eth-typing/issues/28>)

•   Add GrayGlacier to ForkName enum (#30 <https://github.com/ethereum/eth-typing/issues/30>)

  Miscellaneous changes

•   #32 <https://github.com/ethereum/eth-typing/issues/32>

  v3.0.0 (2021-11-15)

•   Update ForkName enum to include Berlin, London, and ArrowGlacier

•   Update Python support to include python 3.8-3.10

•   Remove Python 3.5 support

  v2.2.0 (2019-10-31)

•   Update ForkName enum to include ConstantinopleFix and Istanbul

  v2.1.0 (2019-10-31)

•   Add BLS types

  v2.0.0 (2019-10-31)

•   Expose Type Hints as per PEP 561

  v1.0.0 (2018-06-08)

•   Added annotations from py-evm.

  v0.3.1 (2018-06-07)

•   Removed eth-utils requirement.

  v0.3.0 (2018-06-07)

•   Updated eth-utils requirement.

  v0.2.0 (2018-06-07)

•   Launched repository, claimed names for pip, RTD, github, etc.

  Contributing

Thank you for your interest in contributing! We welcome all contributions no matter their size. Please read along to learn how to get started. If you get stuck, feel free to ask for help in Ethereum Python Discord server <https://discord.gg/GHryRvPB84>.

  Setting the stage

To get started, fork the repository to your own github account, then clone it to your development machine:

    git clone git@github.com:your-github-username/eth-typing.git

Next, install the development dependencies. We recommend using a virtual environment, such as virtualenv <https://virtualenv.pypa.io/en/stable/>.

    cd eth-typing
    virtualenv -p python venv
    . venv/bin/activate
    python -m pip install -e ".[dev]"
    pre-commit install

  Running the tests

A great way to explore the code base is to run the tests.

We can run all tests with:

    pytest tests

  Code Style

We use pre-commit <https://pre-commit.com/> to enforce a consistent code style across the library. This tool runs automatically with every commit, but you can also run it manually with:

    make lint

If you need to make a commit that skips the pre-commit checks, you can do so with git commit --no-verify.

This library uses type hints, which are enforced by the mypy tool (part of the pre-commit checks). All new code is required to land with type hints, with the exception of code within the tests directory.

  Documentation

Good documentation will lead to quicker adoption and happier users. Please check out our guide on how to create documentation for the Python Ethereum ecosystem <https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/documentation.md>.

  Pull Requests

It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission.

GitHub's documentation for working on pull requests is available here <https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>.

Once you've made a pull request, take a look at the Circle CI build status in the GitHub interface and make sure all tests are passing. In general pull requests that do not pass the CI build yet won't get reviewed unless explicitly requested.

If the pull request introduces changes that should be reflected in the release notes, please add a newsfragment file as explained here <https://github.com/ethereum/eth-typing/blob/main/newsfragments/README.md>.

If possible, the change to the release notes file should be included in the commit that introduces the feature or bugfix.

  Network ChainIds

A list of ChainId constants reside in the eth-typing/networks.py file. This list should be kept in sync with the network list available on [chainid.network](<https://chainid.network/chains_mini.json>).

To keep the list up to date, run the following command:

    python update_network_chain_ids.py

This will remove the original networks file and output a new file with the new networks added.

Check that the output file is correct and that constants are defined as expected. If the shortName contains special characters it may not work as a constant variable name. The script should be updated to transform names into valid constants as new cases occur.

  Releasing

Releases are typically done from the main branch, except when releasing a beta (in which case the beta is released from main, and the previous stable branch is released from said branch).

  Final test before each release

Before releasing a new version, build and test the package that will be released:

    git checkout main && git pull
    make package-test

This will build the package and install it in a temporary virtual environment. Follow the instructions to activate the venv and test whatever you think is important.

You can also preview the release notes:

    towncrier --draft

  Build the release notes

Before bumping the version number, build the release notes. You must include the part of the version to bump (see below), which changes how the version number will show in the release notes.

    make notes bump=$$VERSION_PART_TO_BUMP$$

If there are any errors, be sure to re-run make notes until it works.

  Push the release to github & pypi

After confirming that the release package looks okay, release a new version:

    make release bump=$$VERSION_PART_TO_BUMP$$

This command will:

•   Bump the version number as specified in .pyproject.toml and setup.py.

•   Create a git commit and tag for the new version.

•   Build the package.

•   Push the commit and tag to github.

•   Push the new package files to pypi.

  Which version part to bump

$$VERSION_PART_TO_BUMP$$ must be one of: major, minor, patch, stage, or devnum.

The version format for this repo is {major}.{minor}.{patch} for stable, and {major}.{minor}.{patch}-{stage}.{devnum} for unstable (stage can be alpha or beta).

If you are in a beta version, make release bump=stage will switch to a stable.

To issue an unstable version when the current version is stable, specify the new version explicitly, like make release bump="--new-version 4.0.0-alpha.1"

You can see what the result of bumping any particular version part would be with bump-my-version show-bump

  Code of Conduct

  Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

  Our Standards

Examples of behavior that contributes to creating a positive environment include:

•   Using welcoming and inclusive language

•   Being respectful of differing viewpoints and experiences

•   Gracefully accepting constructive criticism

•   Focusing on what is best for the community

•   Showing empathy towards other community members

    Examples of unacceptable behavior by participants include:

•   The use of sexualized language or imagery and unwelcome sexual attention or advances

•   Trolling, insulting/derogatory comments, and personal or political attacks

•   Public or private harassment

•   Publishing others' private information, such as a physical or electronic address, without explicit permission

•   Other conduct which could reasonably be considered inappropriate in a professional setting

  Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

  Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

  Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <snakecharmers@ethereum.org>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

  Attribution

This Code of Conduct is adapted from the Contributor Covenant <https://www.contributor-covenant.org>, version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

Author
The Ethereum Foundation

Copyright
2018-2023, The Ethereum Foundation