This is for core devs to improve pdr-backend repo itself.
Follow directions to install pdr-backend in predictoor.md
Local barge. If you're on ubuntu, you can run barge locally.
- First, install barge.
- Then, run it. In barge console:
./start_ocean.sh --no-provider --no-dashboard --predictoor --with-thegraph
Or, remote barge. If you're on MacOS or Windows, run barge on VPS.
- Follow the instructions in vps.md
Open a new "work" console and:
# Setup virtualenv
cd pdr-backend
source venv/bin/activate
# Set PRIVATE_KEY
export PRIVATE_KEY="0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58"
# Unit tests default to using "development" network -- a locally-run barge.
# If you need another network such as barge on VPS, then override the endpoints for the development networkAll other settings are in ppss.yaml. Some of these are used in unit tests. Whereas most READMEs make a copy my_ppss.yaml, for development we typically want to operate directly on ppss.yaml.
In work console, run tests:
# (ensure PRIVATE_KEY set as above)
# run a single test. The "-s" is for more output.
# note that pytest does dynamic type-checking too:)
pytest pdr_backend/util/test_noganache/test_util_constants.py::test_util_constants -s
# run all tests in a file
pytest pdr_backend/util/test_noganache/test_util_constants.py -s
# run a single test that flexes network connection
pytest pdr_backend/util/test_ganache/test_contract.py::test_get_contract_filename -s
# run all regular tests; see details on pytest markers to select specific suites
pytestIn work console, run linting checks.
# auto-fix some pylint complaints like whitespace. CI doesn't modify files; we do
black ./
# run linting on code style. Use same setup as CI
pylint --rcfile .pylintrc * pdr_backend/*
# mypy does static type-checking and more. Use same setup as CI
mypy --config-file mypy.ini ./In work console:
coverage run --omit="*test*" -m pytest # Run all. For subset, add eg: pdr_backend/lake
coverage report # show resultsLet's say you want to change the trader agent, and use off-the-shelf agents for everything else. Here's how.
In barge console:
# (Hit ctrl-c to stop existing barge)
# Run all agents except trader
./start_ocean.sh --predictoor --with-thegraph --with-pdr-trueval --with-pdr-predictoor --with-pdr-publisher --with-pdr-dfbuyerIn work console:
#(ensure envvars set as above)
# run trader agent, approach 1
pdr trader 1 ppss.yaml development
# or
pdr trader 1 ppss.yaml barge-pytest(You can track at finer resolution by writing more logs to the code, or querying Predictoor subgraph.)
In the CLI, simply point to a different network:
# run on testnet
pdr trader ppss.yaml sapphire-testnet
# or, run on mainnet
pdr trader ppss.yaml sapphire-mainnetSee dependencies.md for more details.
Run this once a year to update the license headers. Since this is not something we do everyday, do not include the dependency in setup.py. Instead, install it manually using pip:
pip install licenseheaders
licenseheaders -cy -t ./copyright_template.tmpl -x venv/**.py