README.md
See Installing Vyper to install vyper. See Tools and Resources for an additional list of framework and tools with vyper support. See Documentation for the documentation and overall design goals of the Vyper language.
See learn.vyperlang.org for learning Vyper by building a Pokémon game. See try.vyperlang.org to use Vyper in a hosted jupyter environment!
Note: Vyper is constantly evolving, use with care and understand the risks associated with smart contract development.
See the Vyper documentation for build instructions.
To compile a contract, use:
vyper your_file_name.vy
generate bytecode
vyper -f bytecode file-name.vy > file-name.bin
generate abi
vyper -f abi file-name.vy > file-name.abi
There is also an online compiler available you can use to experiment with
the language and compile to bytecode and/or IR.
Note: While the vyper version of the online compiler is updated on a regular basis it might be a bit behind the latest version found in the master branch of this repository.
Make sure you have uv installed
cd into itgit fetch --tags [email protected]:vyperlang/vyper.git to get the tags necessary for version inferenceuv syncsource .venv/bin/activate to activate the virtual environmentvyper --version to verify the setupMake sure you have pip, setuptools, and pytest installed
cd into itgit fetch --tags [email protected]:vyperlang/vyper.git to get the tags necessary for version inferencepython -m venv .venv to create a virtual environmentsource .venv/bin/activate to activate itmake init to install the main dependenciesmake dev-init to install the dev dependenciesvyper --version to verify the setupvyper path/to/file.vy to run your local copy of the compilerpytest to test your changes
Useful pytest flags:
* -x: Fail test run on first test failure
* --instafail: Show reason for test failure directly, instead of at the end of a test run
* --disable-warnings: Hide warnings which occurred during testsmake mypy to type check your changesmake lint to check your files are correctly formatted (also runs mypy)To run a python performance profile (to find compiler perf hotspots):
PYTHONPATH=. python -m cProfile -s tottime vyper/cli/vyper_compile.py "$@"
The utility timer functions timeit, profileit and cumtimeit are available in vyper/utils.py.
To get a call graph from a python profile, install gprof2dot and xdot, and run it like gprof2dot -f pstats stats | xdot -. (See https://stackoverflow.com/a/23164271/).
Install hevm by downloading it from the releases page (https://github.com/ethereum/hevm/releases/latest) and making sure it is in your PATH. hevm tests can be enabled with --hevm flag, and hevm tests can be selected with the -m hevm marker. For instance, pytest -m "hevm" --hevm.
Fuzzing test are very slow, so they are not run by default.
To run them, use pytest -m "fuzzing".