Skip to content

How to set up Graphite for development

This document shows how you can set up Graphite project for development tasks.

Step 1: Fork repository

If you want to contribute to Graphite, you should create a fork first:

Fork Graphite from this link

Step 2: Clone repository

  • Install Git.
  • Open terminal in the directory you want to keep project in.
  • Clone git repository: (Replace user-name/graphite with correct path to your fork)
    git clone https://github.com/user-name/graphite.git
    

Note

You need a GitHub account to contribute in Graphite.

Step 3: Install dependencies

  • Install Python. (Works on 3.10 to 3.14)
  • Open terminal in project directory.
  • Install required Python packages with optional development and benchmark dependencies:
    pip install ".[dev, benchmark]"
    

Tips

Creating separated branches

Always create an up-to-date branch when you need to work on a feature or bug fix.

  • Open terminal in project directory.
  • Update your fork's dev branch.
  • Checkout dev branch:
    git checkout dev
    
  • Create a new branch: (Replace <new-branch-name> with your branch name (without <>))
    git checkout -b <new-branch-name>
    
  • Start editing.

Running checks

Always run checks before push to development branches.

  • Open terminal in project directory.
  • Run this command to ensure you have pylint, pytest, and ty:
    pip install ".[dev]"
    
  • Lint code with pylint and modify your code until it get 10.00/10 rating:
    pylint $(git ls-files '*.py')
    
  • Change directory to tests/ with cd tests.
  • Run tests and unsure all are passed:
    pytest
    
  • Use ty to check types:
    ty check
    

Running benchmarks

Run benchmarks before / after your changes to measure performance impacts.

  • Open terminal in project directory.
  • Run this command to ensure you have benchmark dependencies:
    pip install ".[benchmark]"
    
  • Change directory to tests/ with cd tests/
  • Run benchmark (append --help to get more information):
    python benchmark.py