Package: newchain-web3
Web3.pyA Python implementation of NewChain Web3 which is forked fromhttps://github.com/ethereum/web3.py.Python 3.7.2+ supportDeveloper Setupgitclonegit@github.com:xiawu/newchain-web3.py.gitcdnewchain-web3.pyPlease see OS-specific instructions for:LinuxMacWindowsFreeBSDThen run these install commands:virtualenvvenv
.venv/bin/activate
pipinstall-e.[dev]For different environments, you can set up multiplevirtualenv. For example, if you want to create avenvdocs, then you do the following:virtualenvvenvdocs
.venvdocs/bin/activate
pipinstall-e.[docs]pipinstall-e.Using DockerIf you would like to develop and test inside a Docker environment, use thesandboxcontainer provided in thedocker-compose.ymlfile.To start up the test environment, run:docker-compose up -dThis will build a Docker container set up with an environment to run the Python test code.Note: This container does not havego-ethereuminstalled, so you cannot run the go-ethereum test suite.To run the Python tests from your local machine:docker-compose exec sandbox bash -c 'pytest -n 4 -f -k "not goethereum"'You can run arbitrary commands inside the Docker container by using thebash -cprefix.docker-compose exec sandbox bash -c ''Or, if you would like to just open a session to the container, run:docker-compose exec sandbox bashTesting SetupDuring development, you might like to have tests run on every file save.Show flake8 errors on file change:# Test flake8when-changed-v-s-r-1web3/tests/ens/-c"clear; flake8 web3 tests ens && echo 'flake8 success' || echo 'error'"You can usepytest-watch, running one for every Python environment:pipinstallpytest-watchcdvenv
ptw--onfail"notify-send -t 5000 'Test failure ⚠⚠⚠⚠⚠' 'python 3 test on web3.py failed'"../tests../newchain_web3Or, you can run multi-process tests in one command, but without color:# in the project root:pytest--numprocesses=4--looponfail--maxfail=1# the same thing, succinctly:pytest-n4-f--maxfail=1How to Execute the Tests?Setup your development environment.Executetoxfor the testsThere are multiplecomponentsof the tests. You can run test to against specific component. For example:# Run Tests for the Core component (for Python 3.5):tox-epy35-core# Run Tests for the Core component (for Python 3.6):tox-epy36-coreIf for some reason it is not working, add--recreateparams.toxis good for testing against the full set of build targets. But if you want to run the tests individually,py.testis better for development workflow. For example, to run only the tests in one file:py.testtests/core/gas-strategies/test_time_based_gas_price_strategy.pyRelease setupFor Debian-like systems:apt install pandocTo release a new version:makereleasebump=$$VERSION_PART_TO_BUMP$$How to bumpversionThe version format for this repo is{major}.{minor}.{patch}for stable, and{major}.{minor}.{patch}-{stage}.{devnum}for unstable (stagecan be alpha or beta).To issue the next version in line, specify which part to bump,
likemake release bump=minorormake release bump=devnum.If you are in a beta version,make release bump=stagewill switch to a stable.To issue an unstable version when the current version is stable, specify the
new version explicitly, likemake release bump="--new-version 4.0.0-alpha.1 devnum"