Skip to content

Conversation

@DrInfiniteExplorer
Copy link

This is my first PR for Bonsai and I expect it might lead to some discussion.

Current guidelines

Current development guides recommend using the “Blender Development” VS Code extension. For Bonsai development this extension offers limited value:

  • Its primary function - symlinking an add-on repository into Blender’s installation directory - is already handled by src/bonsai/scripts/dev_environment.py.

  • Its debug workflow launches Blender with its own arguments and manages a debugpy server internally. This bypasses VS Code’s launch configurations and prevents correct source-path mapping between the Blender install tree and the repository tree.

A mentioned alternative is the lightweight hextant_python_debugger add-on, which supports custom launch configurations. However, it must be installed separately, and starting the debugpy server requires manual steps inside Blender each time it's started.

Proposed Change

This PR introduces:

  • launch.json
  • tasks.json
  • A helper script that generates/updates settings.json with the correct Blender installation path and source-mapping configuration.

The workflow becomes:

  • Task 1 (once): Runs the helper script to populate the necessary workspace settings.
  • Task 2 (once): Installs debugpy into the Blender Python environment if required.
  • Task 3: Launches Blender and starts the debugpy server with the correct arguments.

The launch configuration then attaches to Blender with full path mapping, ensuring that breakpoints resolve to files in the repository rather than the installation directory. It also enables reliable use of “Just My Code”.

Benefits

  • Consistent and reproducible debug configuration across contributors.
  • Proper source-path mapping without manual intervention.
  • No additional Blender add-ons required.
  • Debug workflow fully integrated into VS Code tasks and launch configurations.
  • Faster onboarding for new contributors.

This PR intends to streamline and simplify the development and debugging experience for Bonsai developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant