Skip to content

fix(notebook): launch UI with current Python interpreter - #982

Open
sivakumar-mahalingam wants to merge 2 commits into
apache:mainfrom
sivakumar-mahalingam:fix/981-notebook-python-interpreter
Open

sivakumar-mahalingam wants to merge 2 commits into
apache:mainfrom
sivakumar-mahalingam:fix/981-notebook-python-interpreter

Conversation

@sivakumar-mahalingam

Copy link
Copy Markdown

Fixes #981

The %burr_ui notebook integration launched its server subprocess using the literal python command. In notebook environments where python resolves to a different installation—or is unavailable—the server could fail even though Burr was installed in the active kernel.

Changes

  • Use sys.executable when launching the Burr UI from Jupyter.
  • Use sys.executable when launching the Burr UI from Google Colab.
  • Add regression tests covering both launch paths.

How I tested this

  • pytest tests/integrations/test_notebook.py -v — 2 passed.
  • python -m compileall passed for the changed files.
  • git diff --check passed.
  • Black, isort, flake8, AST, whitespace, and ASF license-header checks passed.
  • The unrelated frontend pre-commit hook could not run because npx is unavailable in the test environment. No frontend files were changed.

Notes

No public API changes or documentation updates are required. The notebook UI now consistently uses the same Python environment as the active notebook kernel.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@github-actions github-actions Bot added the area/integrations External integrations (LLMs, frameworks) label Oct 18, 2026

@enekoreto enekoreto left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks right to me. I checked out the branch (343de50): both new tests fail on main (8bfd726, the command starts with 'python') and pass here. I also started the UI for real with launch_ui_jupyter() from a venv whose path has a space and isn't on PATH. On main it fails with FileNotFoundError: ... 'python' (my Mac only has python3), and with this change the server comes up and answers (from a source checkout, so with BURR_SERVE_STATIC=false).

But I think the new test file will break CI: the test job installs .[tests,tracking-client,tracking-server,graphviz], which doesn't include IPython, and burr.integrations.notebook imports it at module level. With CI's test command the run stops at collection (ModuleNotFoundError: No module named 'IPython', Interrupted: 1 error during collection), so no tests run at all.

Adding pytest.importorskip("IPython") before the import, like test_bip0042_bedrock.py does for boto3, fixed it for me: without IPython the file is skipped and CI's command passes, and with IPython both tests still pass. Adding ipython to the test job's install should also work, if you'd rather have these tests run in CI.

I ran this on Python 3.13 on macOS, and the new tests also on 3.10.

@sivakumar-mahalingam

Copy link
Copy Markdown
Author

Thanks for catching this @enekoreto I added IPython to dependencies so the notebook tests are collected and executed in CI rather than skipped.

@github-actions github-actions Bot added the area/ci Workflows, build, release scripts label Oct 20, 2026
@enekoreto

Copy link
Copy Markdown

Thanks! Rechecked at e6817ff: with ipython in the tests extra, a fresh env with the test job's install (Python 3.10) collects and runs both notebook tests, and the full test command passes. Looks good to me.

This branch has not been deployed

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

Labels

area/ci Workflows, build, release scripts area/integrations External integrations (LLMs, frameworks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notebook UI launcher should use the current Python interpreter

2 participants