Chalk home page
  1. Notebooks
  2. Setup



Install Chalk in your notebook environment by running the following command in a cell:

!pip install chalkpy[all]


To use Chalk in a notebook, we will need to generate a client ID and secret key pair.

In the Chalk Dashboard, under Settings > Access Tokens, generate a client ID and secret key pair by clicking on New Token and selecting all necessary permissions.

We will need the client ID and client secret we generated to initialize a Chalk client in our notebook.

Environment Setup

You can use the ChalkClient from any Jupyter notebook environment.


If you are working with a local notebook, Chalk will pick up your credentials generated from running chalkpy login in your terminal.

All you need to do is initialize the client:

from chalk.client import ChalkClient

client = ChalkClient()


On Deepnote, you can set environment variables by going to the integrations tab and clicking on the “Environment Variables” button.

Deepnote Environment Variables

Set the CHALK_CLIENT_ID and CHALK_CLIENT_SECRET variables to the values you generated in the previous step. You can then initialize Chalk by running the following code in a cell:

import os
from chalk import ChalkClient

client = ChalkClient()


On Hex, you can store the client ID and secret key using secrets

Hex Secrets

Select Python 3.10 as the image under Environment > Compute Profile.

Hex Python Image

The Chalk client can then be initialized referencing the variables directly

from chalk import ChalkClient

client = ChalkClient()

Creating a branch

To start using Chalk in a notebook, we will need to create a branch deployment. Branch deployments are isolated environments that can be used to test features and resolvers before deploying them to production.

Working in a branch makes it seamless to iterate on features and resolvers in notebooks. Any time we execute a cell in our notebook with feature or resolver definitions, Chalk will automatically update our branch deployment with the latest changes.

Once you’ve got your client setup, you can create a branch calling create_branch. Setting switch=True will point your client to the newly created branch.

client.create_branch("my-branch", switch=True)