ethpandaops / ethereum-package

A Kurtosis package that deploys a private, portable, and modular Ethereum devnet
MIT License
218 stars 119 forks source link

Add params and docstring to run function in main.star #364

Open tedim52 opened 9 months ago

tedim52 commented 9 months ago

The main.star should contain a doc string that specifies exactly what the possible input args are, which ones are required and which ones are default, and what their descriptions are types are. This will make it easier for users to get onboarded to the ethereum package as they'll know what's parametrizable via a json/yaml file without having to go to package_io or go off solely example inputs, (author consumer divide)

A good example to go off of is the hyperlane package.

Doing this will also make the package render with a nice form input in Kurtosis Cloud like by parsing docstring

Screen Shot 2023-11-19 at 3 20 07 AM

Whereas the ethereum package one looks like this:

Screen Shot 2023-11-19 at 3 21 01 AM
barnabasbusa commented 9 months ago

I think if we go down this road, this should be hidden under a group that is collapsable.

And with the default params filled out. And with the option to override all with a single yaml config.

tedim52 commented 9 months ago

Yep. This is all possible with the docstring! Can specify a default that can be overriden very easily with the yaml configs that already exist. I'll create a PR and request ya to demonstrate how it works.

mieubrisse commented 9 months ago

Default params for primitive values are actually already implemented in the newest version of Kurtosis:

Screen Shot 2023-11-21 at 21 45 12

The option to override all with a single YAML config is definitely something we'll have in the near term (though we don't have it yet).

Collapsible groups - what did you have in mind @barnabasbusa ?

barnabasbusa commented 9 months ago

ethereum-package will have tens of different config parameters.

If you have all of them "open" in a non collapsed manner, its gonna take up the whole page.

Would be good to separate them into parts, such as participant group, network config, other configs, additional-tooling.

mieubrisse commented 9 months ago

This is possible simply by making them separate parameters to the run function, e.g.:

def run(plan, participants=[], additional_tools=[], etc.):

This will also allow each of them to have separate documentation, a la: https://github.com/kurtosis-tech/hyperlane-package/blob/main/main.star#L24