DEV Community

Cover image for Recommended Codespace Configuration for Polyglot Notebooks
Matt Eland
Matt Eland Subscriber

Posted on • Originally published at accessibleai.dev

Recommended Codespace Configuration for Polyglot Notebooks

In order to get Polyglot Notebooks to work with GitHub Codespaces, you'll need to match the current requirements of the Polyglot Notebooks extension and its underlying .NET Interactive kernels.

This relies on two files in your .devcontainer directory:

  • Dockerfile which describes the Docker container the Codespace will run in
  • devcontainer.json which describes how the dev container is configured in terms of extensions and ports

Current Requirements

As of September of 2024, Polyglot Notebooks requires the .NET 8 SDK.

Therefore, I recommend the following settings as basic starter templates:

Dockerfile

In the dockerfile, it's important to use the .NET image that Polyglot Notebooks currently requires. At the moment, this is .NET 8.

ARG VARIANT="8.0"
FROM mcr.microsoft.com/devcontainers/dotnet:${VARIANT}

ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
Enter fullscreen mode Exit fullscreen mode

devcontainer.json

The devcontainer.json file is a bit more flexible, but the critical thing we need to do is specify that the VS Code extension ms-dotnettools.dotnet-interactive-vscode should be installed. This is the Polyglot Notebooks extension.

{
    "name": "ASPNET",
    // Configure tool-specific properties.
        "build": {
            "dockerfile": "Dockerfile",
            "args": {
                "VARIANT": "8.0",
                "NODE_VERSION": "16"
            }
        },
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            "extensions": [
                "GitHub.github-vscode-theme", // Optional. Codespace IDE theming.
                "ms-dotnettools.csharp", // Optional. Helpful for C# development
                "ms-dotnettools.dotnet-interactive-vscode" // Polyglot Notebooks. Required
            ]
        }
    },
    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    "forwardPorts": [],
    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "gcc -v",
    "onCreateCommand": "echo PS1='\"$ \"' >> ~/.bashrc && dotnet dev-certs https", //Set Terminal Prompt to $
    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    "remoteUser": "vscode",
    "features": {
        "powershell": "latest"
    }
}
Enter fullscreen mode Exit fullscreen mode

While these settings are initially picked based on those in my book, Data Science in .NET with Polyglot Notebooks, this is intended to be a living document that can be updated as Polyglot Notebooks moves to future versions of .NET or the recommended configuration settings change.

If you have any suggestions or corrections to make to either the Dockerfile or the devcontainer.json file, please get in touch with me.

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay