Setup

Prerequisites

Note

All of the commands below should be run from the root of the repository.

Setup

To setup a development environment, first install the necessary development dependencies:

sudo bash dependencies/development.{operating-system}.sh

Where {operating-system} is either ubuntu or macos.

Warning

There are some dependencies that the scripts cannot install automatically for you - please check the output for warnings and more information.

Note

Python packages should be installed in a Virtual Environment for development purposes. If you’re not familiar with using Virtual Environments, go brush up on them now.

Then install the Python package with pip in editable mode, with extras for development, and with frozen dependencies:

pip install -e .[development] -c constraints.txt

Code Style

Pre-commit hooks are available for automatic code formatting, linting, and type checking. To enable them (after installing development dependencies) run:

pre-commit install

Documentation

To build the documentation (after Setup), from the docs/ directory run:

make html

Or other supported sphinx output formats.

Extras

Installing Ghidra on MacOS

In general, you should follow Ghidra’s installation instructions, but here are a few tips.

  1. Install OpenJDK with Homebrew

    brew install openjdk
    
  2. Download and extract a Ghidra release directly from GitHub. The directory scheme /opt/ghidra/{version}/ works well.

  3. Disable MacOS code verification for Ghidra, otherwise you will have to auth every time you want to run it.

    xattr -dr com.apple.quarantine /opt/ghidra/
    
  4. Make sure you set the GHIDRA_INSTALL_DIR environment variable when running scripts that use Ghidra.

    GHIDRA_INSTALL_DIR=/opt/ghidra/11.4.1/ \
        python -m undertale ...