Skip to content

Latest commit

 

History

History
93 lines (62 loc) · 2.7 KB

DEV_GUIDE.md

File metadata and controls

93 lines (62 loc) · 2.7 KB

Developer's guide

Purpose of this guide to make possible develop code for for the small group.

Please make sure to install requirements_dev.txt first.

IDE

VScode is highly recommended. but some plugin are required to make it works.

GitLens

Formatter

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

Git best practices

Pleas install git-flow

Testing

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/

Coding style

Google style docustring

Mypy hints cheat sheet

Running end-to-end integration test

./bin/xbench.sh run -c <your clsuter name> -t itest -i itest -b sysbench -w itest -o /tmp -a /tmp

git pre-commit hooks

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.