Skip to content

Configure Comet

The way you configure Comet depends on whether you choose to run your project through a script or a Jupyter Notebook. This page describes how to configure using a script. For more information about using a Jupyter Notebook, see Use Comet in Jupyter Notebooks.

To configure Comet in a script, use any one of the following three methods:

Configure Comet within the source code

You can configure Comet directly from your source code.

import comet_ml

experiment = comet_ml.Experiment(
    api_key="<Your API Key>",
    workspace="<Your Workspace Name>",
    project_name="<Your Project Name>",

For a full list of configuration options available through the Experiment object, see Configuration Variables.

Configure Comet through environment variables

Before running your script, you can configure your Comet project by setting your credentials through the following environment variables:

export COMET_API_KEY="<Your API Key>"
export COMET_WORKSPACE="<Your Workspace Name>"
export COMET_PROJECT_NAME="<Your Project Name>"

Configure Comet using the Comet config file

Comet also lets you configuring your project using a dedicated configuration file. This file should be named .comet.config. You can place this file wherever you like and configure its path through the following environment variable:

export COMET_CONFIG=<Path To Your Comet Config>

The most important parameters you will have to configure in this file are the following:

api_key=<Your API Key>
workspace=<Your Workspace Name>
project_name=<Your Project Name>

Learn more

Nov. 23, 2023