Developer’s Guide#

Development Dependencies#

Building the package from source additionally requires the following dependencies:

  • cython (>=3.0a4)

We also use pre-commit hooks to identify simple issues before submission.

Development Installation#

For development installation, we recommend using uv:

  1. Clone the repository:

    git clone https://github.com/zillow/quantile-forest.git
    cd quantile-forest
    
  2. Create a virtual environment:

    uv venv
    
  3. Build the package:

    uv pip install --editable . --verbose
    
  4. Install and configure pre-commit hooks:

    uv pip install pre-commit
    pre-commit install
    

    You can run the hooks manually on all files with:

    pre-commit run --all-files
    
  5. Run the test suite to verify the installation:

    uv run pytest
    

Troubleshooting#

If the build fails because SciPy is not installed, ensure OpenBLAS and LAPACK are available and accessible.

On macOS, run:

brew install openblas
brew install lapack
export SYSTEM_VERSION_COMPAT=1

Test and Coverage#

Ensure that pytest and pytest-cov are installed:

uv pip install pytest pytest-cov

To test the code:

uv run pytest quantile_forest -v

To test the code and produce a coverage report:

uv run pytest quantile_forest --cov-report html --cov=quantile_forest

To test the documentation:

uv run pytest --doctest-glob="*.rst" --doctest-modules docs

Documentation#

To build the documentation, run:

uv pip install -r ./docs/sphinx_requirements.txt
mkdir -p ./docs/_images
uv run sphinx-build -b html ./docs ./docs/_build