Setting up the development environment:
- Install Python 3.8+
- Install the requirements
You have to repeat this step whenever a commit adds new dependencies.
python3 -m pip install -U pip python3 -m pip install -Ur requirements.txt
- Install the pre-commit hook, that will do some code-format-checking.
Note that this is not an auto-formatter. It will alter some code, but mostly it will just complain about non-compliant code.
pre-commit install
You can disable a certain check for a single line of code if you think your code-style if preferable. E.g.Or use justassume_this_line(violates_rule_e123, and_w321) # noqa: E123,W321
# noqato disable all checks for this line.
If you use# noqaon its own line, it will disable all checks for the whole file. Don't do that.
To disable certain rules for a whole file, check outsetup.cfg.
If you want to run the checks manually, you can do so:pre-commit run --all-files # or pre-commit run --file path/to/a/file
When working with the Rust rewrite of the stubserver, you will also need to
- Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Compile and install the stubserver
TIP:
cargo install --locked --path boltstub_rs
When working on the stubserver, you can usewatchexecto automatically build and install it whenever you change the code:# only once, to install watchexec: cargo install --locked watchexec-cli@2.3.2 # then, whenever you work on the stubserver: watchexec -w boltstub -e rs cargo install --locked --path boltstub_rs