jO-Osko's stub generator
Generate .pyi stubs from abi files to ease typechecking and development with web3py.
Features
Solidity typestub generates .pyi files that enable type directed code completion and typechecking of web3py wrappers around solidity contracts.
Usage
Install using pip pip install solidity_typestub.
Invoke it with solidity_typestub path/to/input/file_or_folder.json path/to/another/file/or/folder ....
Stub generator generates stubs for input files or recursively searches the provided input folder for .json files with abi.
The generated stubs are written to the folder artifacts (configurable) and a dummy __init__.py is generated (provided it does not exist) to make them importable.
Available options:
--no-format,-nf: Do not autoformat generated files using black (default: use autoformatter)--output <directory_name>: Specify output directory (default:artifacts)
contract: SampleContract = w3.eth.contract(address=sample_address, abi=sample_abi)
reveal_type(contract.functions.exampleFun.call)
# note: Revealed type is "def (_arg1: builtins.int, _arg2: builtins.list[builtins.bool]) -> Tuple[builtins.int, builtins.str]"
Roadmap
- Support custom structs
- Support api acquisition of abi files from blockexplorer and blockscout
- More configuration options
- Provide support for
transact()types - Provide workable contracts a-la truffle
- Generate stub files directly from solidity files using
solcx
Contributing
Any contributions are welcome (PR, Issues, documentation, comments).
Acknowledgements
This work builds greatly on ocaml solidity developed by ocamlpro and modified a bit.
AFLabs and Flare foundation for testing and bug reporting.
jO-Osko
Metadata
Release files for solidity-typestub 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| solidity_typestub-0.0.1.tar.gz | 7.0 kB | Without provenance | Details for solidity_typestub-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| solidity_typestub-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for solidity_typestub-0.0.1-py3-none-any.whl |
Total release size: 14.0 kB
Release files / solidity_typestub-0.0.1.tar.gz
| Download URL | solidity_typestub-0.0.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
032f539d774e8a1597f5048d6c0d2151c2bd2389a42a086db1477183f27ac4da
|
|
BLAKE2b-256 checksum How to use checksums |
df861a93e3eaa06256da62e9f9499d2f5d771cad4d91b0771d24955a12e644f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|
Release files / solidity_typestub-0.0.1-py3-none-any.whl
| Download URL | solidity_typestub-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13fe0c315036f31964e719c066534827f384728eb66f18ed4c3cf540d65fee59
|
|
BLAKE2b-256 checksum How to use checksums |
40c9cf645645df757fa2f2a953d1b4534d18403d2bf7bbc5a8961ba034f5e1e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|
Security for solidity-typestub 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.