Package: eth-brownie
BrownieBrownie is a Python-based development and testing framework for smart contracts targeting theEthereum Virtual Machine.Brownie is no longer actively maintained. Future releases may come sporadically - or never at all. Check outApe Frameworkfor all your python Ethereum development needs.FeaturesFull support forSolidity(>=0.4.22) andVyper(>=0.1.0-beta.16)Contract testing viapytest, including trace-based coverage evaluationProperty-based and stateful testing viahypothesisPowerful debugging tools, including python-style tracebacks and custom error stringsBuilt-in console for quick project interactionDependenciespython3version 3.10 or greater, python3-devhardhatorganacheTested with ganache version7.9.2, however it is generally recommended to use hardhat because ganache has been sunsetted.InstallationviapipxThe recommended way to install Brownie is viapipx. pipx installs Brownie into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Brownie.To installpipx:python3-mpipinstall--userpipx
python3-mpipxensurepathTo install Brownie usingpipx:pipxinstalleth-brownieTo upgrade to the latest version:pipxupgradeeth-brownieTo use lastest master or another branch as version:pipxinstallgit+https://github.com/eth-brownie/brownie.git@masterviapipYou can install the latest release viapip:pipinstalleth-brownieviasetuptoolsYou can clone the repository and usesetuptoolsfor the most up-to-date version:gitclonehttps://github.com/eth-brownie/brownie.gitcdbrownie
python3setup.pyinstallas a libraryIf you want to install brownie inside your own project (rather than as a standalone cli tool):exportBROWNIE_LIB=1pipinstalleth-brownieThis loosens the pins on all dependencies. You'll want to make sure you have your ownrequirements.txtto make sure upgrades upstream don't surprise anyone.for developmentThere are extra tools that are helpful when developing:gitclonehttps://github.com/eth-brownie/brownie.gitcdbrownie
python3-mvenvvenv
./venv/bin/pipinstallwheel
./venv/bin/pipinstall-e.-rrequirements-dev.txtUpgrading the pinned versions of dependencies is easy:./venv/bin/pip-compile --upgrade
./venv/bin/pip-compile --upgrade requirements-dev.in
./venv/bin/pip-compile --upgrade requirements-windows.inEven small upgrades of patch versions have broken things in the past, so be sure to run all tests after upgrading things!Quick UsageTo initialize a new Brownie project, start by creating a new folder. From within that folder, type:brownieinitNext, typebrownie --helpfor basic usage information.Documentation and SupportBrownie documentation is hosted atRead the Docs.If you have any questions about how to use Brownie, feel free to ask onEthereum StackExchangeor join us onGitter.TestingTo run the tests, first install the developer dependencies:pipinstall-e.-rrequirements-dev.txtThen usetoxto run the complete suite against the full set of build targets, orpytestto run tests against a specific version of Python. If you are usingpytestyou must include the-p no:pytest-brownieflag to prevent it from loading the Brownie plugin.Using DockerYou can use a sandbox container provided in thedocker-compose.ymlfile for testing inside a Docker environment.This container provides everything you need to test using a Python 3.6 interpreter.Start the test environment:docker-composeup-dTo open a session to the container:docker-composeexecsandboxbashTo run arbitrary commands, use thebash -cprefix.docker-composeexecsandboxbash-c''For example, to run the tests inbrownie/tests/test_format_input.py:docker-composeexecsandboxbash-c'python -m pytest tests/convert/test_format_input.py'Attaching to dockerized RPC clientsYou can also attach to a RPC client already running inside a docker container.For example for running ganache-cli you could just startup the official ganache-cli docker image:dockerrun-p8545:8545trufflesuite/ganache-cliThen in another terminal on your host you could connect to it:brownieconsoleIf you have your RPC client bound to a specific hostname e.g.ganacheyou could create a separate brownie network for it:brownienetworksaddDevelopmentdevcmd=ganache-clihost=http://ganache:8545Then connect to it with:brownieconsole--networkdevContributingHelp is always appreciated! Feel free to open an issue if you find a problem, or a pull request if you've solved an issue.Please check out ourContribution Guideprior to opening a pull request, and join the BrownieGitter channelif you have any questions.LicenseThis project is licensed under theMIT license.