Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental VS Code (code) runtime to juv run #62

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manzt
Copy link
Owner

@manzt manzt commented Dec 18, 2024

This PR adds a code runtime option to juv run, allowing VS Code to be launched in a way similar to other Jupyter runtimes.

juv run --jupyter=code example.ipynb
# or 
# JUV_RUNTIME=code juv run example.ipynb

The approach uses the behavior of the code CLI, which inherits the environment it was run in.

A script is created using the inline metadata so that running code <notebook.ipynb> ensures a virtual environment is available in the VS Code session with the necessary dependencies.

Ideally, we'd have a VS Code extension to dynamically create and register virtual environments for better discoverability. This implementation goes the other way by enabling basic support via the CLI. However, the user must manually select the virtual environment from VS Code's dropdown, where it appears with an obscure, temporary name (derived from the hashed environment created by uv).

This PR adds a `code` runtime option to `juv run`, allowing VS Code to
be launched in a way similar to other Jupyter runtimes. The approach
uses the behavior of the `code` CLI, which inherits the environment
it was run in.

A script is created using the inline metadata so that running `code
<notebook.ipynb>` ensures a virtual environment is available in the VS
Code session with the necessary dependencies.

Ideally, we'd have a VS Code extension to dynamically create and
register virtual environments for better discoverability. This
implementation goes the other way by enabling basic support via the CLI.
However, the user must manually select the virtual environment from VS
Code's dropdown, where it appears with an obscure, temporary name
(derived from the hashed environment created by `uv`).
@manzt manzt marked this pull request as draft December 23, 2024 18:05
@manzt manzt added the enhancement New feature or request label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant