Skip to content

Projects and Launcher

brookie edited this page Nov 3, 2026 · 7 revisions

Projects and Launcher


Overview

A project is a self-contained configuration file that bundles all settings into a single YAML (or JSON) file. Projects can be opened from Python or directly from the JupyterLab launcher tile without writing any code.

The launcher tile provides a no-code workflow: click the tile, pick a project file, and the annotator opens in a full-width tab with its own standalone kernel.


Project vs Config

Both project and config load a YAML/JSON file, but they differ in how overrides are handled:

config= project=
Loads YAML/JSON file Yes Yes
Allows inline parameter overrides Yes — explicit args take precedence No — raises ValueError if any config params are passed
Allows **kwargs (fixed columns) Yes Yes
Supports nested config: key No Yes — loads a base config, then project keys override
Auto-derives project_name from filename No Yes (e.g. my_review.yaml → "My Review")
Sets _project_file internally No Yes
Positional argument No Yes (BioacousticAnnotator('file.yaml') is project=)

In short: config is a starting point you can override; project is a complete specification.

Config example

ba = BioacousticAnnotator(
    data='detections.csv',
    audio='test.flac',
    config='config/review.yaml',       # base settings
    output='outputs/my-reviews.csv',   # override the config's output
)
ba.open()

Project example

ba = BioacousticAnnotator('projects/my_review.yaml')
ba.open()

# Fixed output columns are still allowed
ba = BioacousticAnnotator('projects/my_review.yaml', annotator_id=1234)
ba.open()

Project Files

A project file uses the same schema as a config file — any constructor parameter can be a key:

# projects/my_review.yaml
project_name: My Review
data: data/detections.csv
data_index_column: id              # required because there is a form
audio: audio_path
info_card_title: '[[common_name]]'
display_columns: [common_name, confidence, start_time]
output: outputs/my-reviews.csv
form_config:
    title:
        value: REVIEW
        progress_tracker: true
    select:
        label: Is Valid
        column: is_valid
        required: true
        items: ['yes', 'no']

Nested config inheritance

A project file can reference a base config via the config: key. The base config is loaded first, then project-level keys override:

# projects/site-a-review.yaml
project_name: Site A Review
config: config/base-review.yaml      # base config
data: data/site-a-detections.csv     # override data source
output: outputs/site-a-reviews.csv   # override output
# config/base-review.yaml
data_index_column: id
audio: audio_path
info_card_title: '[[common_name]]'
display_columns: [common_name, confidence, start_time]
form_config:
    select:
        label: Is Valid
        column: is_valid
        items: ['yes', 'no']

This pattern lets multiple project files share the same form, audio, and display settings while varying only the data source and output.


Launcher Tile

The JupyterLab launcher includes a Bioacoustic Annotator tile (under "Other") that opens a project file without writing any code.

Clicking the tile first shows a chooser with three options — Notebook, Annotator, and Config Builder. Pick Config Builder to create or edit configuration files with the GUI (see Config Builder); the steps below describe the Annotator path.

How it works

  1. Click the Bioacoustic Annotator tile in the launcher
  2. A file browser dialog opens — navigate to a .yaml, .yml, or .json project file
  3. The extension starts a standalone Python kernel (no notebook is created)
  4. The project file is loaded via BioacousticAnnotator(project='<path>') and the widget opens in a new tab
  5. When the tab is closed, the standalone kernel is shut down automatically

Path resolution

The launcher resolves paths relative to the file browser's current directory:

  • The kernel's working directory is set to the file browser location
  • The project file path is made relative to that directory
  • All paths inside the project file (e.g. data:, audio:, output:) resolve relative to the kernel's working directory

This means a project file with data: data/detections.csv works correctly regardless of which directory you launched JupyterLab from, as long as you navigate to the project's root directory in the file browser before clicking the tile.

Kernel reuse

If a notebook is already open with an active kernel, the launcher reuses that kernel. Otherwise it starts a new standalone kernel. When using a standalone kernel:

  • No notebook file is created
  • The kernel is owned by the widget and shut down on close
  • Multiple launcher tabs each get their own kernel

Command palette

The launcher command is also available in the JupyterLab command palette as "Bioacoustic Annotator" (bioacoustic:open-project).


Notebook vs Launcher

Notebook (ba.open()) Launcher tile
Opens from Python cell Launcher / command palette
Kernel Notebook kernel (shared) Standalone or reuses notebook kernel
Widget placement Inline or new tab New tab
Requires notebook Yes No
Config method Any (constructor args, config, project) Project file only
Kernel lifecycle Managed by notebook Shut down when tab closes (if standalone)

From a notebook

from jupyter_bioacoustic import BioacousticAnnotator

# Inline (below the cell)
ba = BioacousticAnnotator(data=df, audio='test.flac')
ba.open()

# New tab
ba.open(inline=False)

# From a project file
ba = BioacousticAnnotator(project='projects/my_review.yaml')
ba.open()

From the launcher

Click the tile, pick a project file, done. The interface is identical — only the launch method differs.

Clone this wiki locally