vyperlang / titanoboa

a vyper interpreter
https://titanoboa.readthedocs.io
Other
247 stars 49 forks source link

use python import hooks to provide native import experience #148

Closed charles-cooper closed 6 months ago

charles-cooper commented 6 months ago

we should override python imports (https://docs.python.org/3/reference/import.html#import-hooks) so that you can import vyper contracts directly and get a VyperDeployer. example:

# my_script.py

import MyContract

c = MyContract.deploy(...)

assert c.add(1, 2) == 3
charles-cooper commented 6 months ago

this was implemented in #149.

it might be nice to extend the functionality to also try loading from a json abi file -- but i'm not sure how often people are doing this in practice (probably the main use case for loading from abi is covered by boa.from_etherscan)