Purpose of this guide to make possible develop code for for the small group.
Please make sure to install requirements_dev.txt first.
VScode is highly recommended. but some plugin are required to make it works.
pip install black
settings.json has the following:
"python.formatting.blackArgs": [
"--line-length",
"88",
"--preview",
],
Linting We use mypy as a linter.
Spell checker Better brackets Docustring Better comments Color theme
Pleas install git-flow
Install development requirements
pip3 install -r requirements_dev.txt
We do code testing using pytest. Tests should be in the test directory and follow pytest requirements ('__test.py') in order to be discovered by pytest
You will need to setup your PYTHONPATH
for running tests
# run all tests
$ PYTHONPATH=$(pwd):$PYTHONPATH XBENCH_HOME=$(pwd) pytest ./test/
Mypy hints cheat sheet
./bin/xbench.sh run -c <your clsuter name> -t itest -i itest -b sysbench -w itest -o /tmp -a /tmp
We don't want to commit ipython notebook outputs into the repo. Here is a git pre-commit hook that I use to automatically strip the outputs from ipython notebooks.
#!/usr/bin/env bash
# requires `nbstripout` to be available on your PATH
# can be installed with `pip`
#set -x
find . -name '*.ipynb' -type f | while read nb; do
jupyter nbconvert --clear-output --inplace ${nb}
done
To install the pre-commit hook, make sure you have installed nbstripout
with pip
,
then copy this script to .git/hooks/pre-commit
and make it executable with
chmod +x .git/hooks/pre-commit
. Now when you go to commit, the script will run
automatically for you.