Rules Engine
June 2, 2026 ยท View on GitHub
This is the workspace for the HEAT rules engine.
For an outline of the logic behind the rules engine and a glossary of common terms, see the Intro to Rules Engine wiki page.
Local Environment Setup
This project uses Python version 3.13.
- Clone or fork the git repository, if not already done.
- (Optional) Install
pre-commit
- On MacOS:
brew install pre-commit - On Windows:
- Open a Git Bash terminal
- If you lack Homebrew,
- Install Homebrew with
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Follow the steps that appear in the prompt following Homebrew installation
- Install Homebrew with
brew install pre-commit
- Open Git Bash terminal.
- Install
uv
- On MacOS
brew install uv - On Windows,
pip install uv
- Navigate to project's python directory by typing
cd python. - Still in python folder, run
pip install -e .to install rules-engine. - Run
source setup-python.sh - Run
pytestand see tests run successfully. Next steps: README.md
Development
Using a codespace for environment setup is highly recommended. Local environment setup can produce small build issues that can be hard to diagnose. If you prefer setting up locally without using a codespace, see Appendix A
Setup Codespace
If you are coding with another person, only one of you needs to do these steps.
- From github, either open the main repo or a fork.
- navigate to the green "code" dropdown
- select the "codespaces" tab
- select the "..." menu
- select "new with options"
- on the options screen, under "Dev container configuration", select "Rules engine"
- click "Create codespace". This will open a web version of VSCode.

Co-edit with LiveShare
If you are not coding with others and you want to use the web version of VSCode provided by the codespace, you can skip this step.
The owner of the codespace:
- Install LiveShare extenion.
- Open LiveShare extension.
- Start a new session. This will copy a LiveShare link into your clipboard.
- Open a new terminal.
Open Editor
- Open the link created for the LiveShare session.
- When prompted, open in local VSCode or with Codespace on the web.
Open Terminal
- To create a new terminal, select the
Terminal => Newmenu option. - To open an existing terminal, select the terminal in the terminal pane.
- If you did not create the terminal, you will see a message to press Enter. This creates a request for the terminal owner to give you read/write access.
- When the terminal owner gives you access, you will see an alert to press any key to focus the terminal. Press the alert.
Modifying Code for an Issue
- Find an issue to work on
- Open a bash terminal
- Create a branch from main. Best practice for naming looks like this: <issue, feature, or other>/
/ . Separate words in the description using a dash (-). Consider using the subject as a description. Example:
git checkout main
git checkout -b feature/341/validate-address
- Commit frequently when you have made progress on the issue (you can always rollback). Advantages:
- incrementaly roll back smaller changes
- review smaller changes
- prevent losing unsaved files
- get sense of progress
To revert a commmit:
git reset --hard HEAD~1if you want to go to the previous commit. If you want to revert 2 commits, dogit reset --hard HEAD~2.- if you have pushed the branch to github, you can either delete the branch from github and push again or do a force push.
Adding Python Packages
Check with a development lead before adding a python package. Adding python packages to development can be useful for syntax checking, testing, and building purposes, but should be avoided for production src code. Incorporating new packages into rules-engine.whl, which is used by the front end, is complicated. To add a package to development:
- Add package to the "dev" section of pyproject.toml
- Run pip-compile as described in the comments of requirements-dev.txt. These instructions will autogenerate requirements-dev.txt.
Committing Your Changes
Before committing your changes, go to the python directory and run source prepare.sh from the terminal to format, check for typing errors, and run all tests via pytest.
Creating a Pull Request
- Rebase from main if not done recently.
git checkout main
git pull origin main
git checkout <your branch>
git rebase main
- run the following validation commands first and fix any errors:
source check.python.sh
- Push your branch either to a fork of the repository or to the main repo (if you have privileges):
git push origin <branch_name>. - Create pull request from github.
- Include statement "Closes
#<issue number>" if your changes completely fix or address the issue. - Check that all checks pass in the pull request.
- Include statement "Closes
- Review file changes.
- Include a brief description of changes in each file.
- Request reviewers.