Vyper Support

Populus has support for the vyper compiler. Vyper is a python-like experimental programming language.

Known limitations

Vyper requires Python 3.6 or above.


To install the compiler:

pip install https://github.com/ethereum/vyper/archive/master.zip

You will see the vyper binary is now installed.

$ vyper
usage: vyper [-h] [-f {abi,json,bytecode,bytecode_runtime,ir}]
vyper: error: the following arguments are required: input_file


To use it as your compiler backend the project.json file must be modified. Place a backend key in the compilation section, as shown below:

    "version": "8",
    "compilation": {
        "contracts_source_dirs": ["./contracts"],
        "import_remappings": [],
        "backend": {
            "class": "populus.compilation.backends.VyperBackend"

This will set the Populus framework to only pick up Vyper contracts in the configured contracts directories. Now that everything is configured you can create a Vyper greeter contract:

# contracts/Greeter.v.py

greeting: bytes <= 20

def __init__():
    self.greeting = "Hello"

def setGreeting(x: bytes <= 20):
    self.greeting = x

def greet() -> bytes <= 40:
    return self.greeting

And run the default Populus tests: