Skip to main content

vscode-colab: Connect VS Code to Google Colab and Kaggle Runtimes

PyPI version License: MIT Python Version Open In Colab Ask DeepWiki

Logo

vscode-colab is a Python library that seamlessly connects your Google Colab or Kaggle notebooks to Visual Studio Code (VS Code) using VS Code Remote Tunnels. It allows you to leverage VS Code's powerful editor and extensions while using the computational resources of cloud-based notebooks.

🚀 Key Features

  • Secure, Official Integration: Uses official VS Code Remote Tunnels for secure, stable connections.
  • GitHub Integration: Automatically authenticated via GitHub, enabling seamless cloning and pushing to private repositories.
  • Easy Git Configuration: Optionally configure global Git identity (user.name and user.email) directly from the library.
  • Extension Support: Installs essential Python and Jupyter extensions by default; easily customize by passing additional extensions.
  • Python Environment Management: Optionally set up a specific Python version for your project using pyenv. (Note: Installing a new Python version via pyenv can take approximately 5 minutes).
  • Project Scaffolding: Optionally create a new project directory with a Python virtual environment.
  • Minimal Setup: Simple and intuitive login() and connect() functions.
  • Cross-Platform Compatibility: Fully supports both Google Colab and Kaggle notebooks.
  • Interactive UI: Integrated UI within notebooks to manage authentication and tunnel connections easily.

🧰 Installation

Install the package using pip:

pip install vscode-colab

📖 Usage

Open In Colab

1. Import the Library

In your Colab or Kaggle notebook:

import vscode_colab

2. Authenticate with GitHub

Authenticate using GitHub credentials:

vscode_colab.login()

Login

Follow the displayed instructions to authorize the connection.

3. Establish the Tunnel and Configure Git (Optional)

To start the VS Code tunnel, optionally configure Git, set up a Python version, or create a new project:

vscode_colab.connect(
    name="my-tunnel",
    git_user_name="Your Name",
    git_user_email="you@example.com",
    setup_python_version="3.13",  # Optional: Specify Python version to install with pyenv
    create_new_project="my_new_project" # Optional: Create a new project directory
)

Connect

  • By default, VS Code Python and Jupyter extensions are installed.
  • You can customize the extensions to be installed:
# Add C++ extensions in addition to default ones
vscode_colab.connect(extensions=["ms-vscode.cpptools"])

# Completely override extensions (only install C++ support)
vscode_colab.connect(extensions=["ms-vscode.cpptools"], include_default_extensions=False)

# Setup a specific Python version and create a new project
# Note: Installing Python with pyenv can take ~5 minutes.
vscode_colab.connect(
    name="py-project-tunnel",
    setup_python_version="3.9",
    create_new_project="data_analysis_project",
    new_project_base_path="~/projects", # Optional: specify where to create the project
    venv_name_for_project=".venv-data" # Optional: specify venv name
)

4. Connect via VS Code

In your local VS Code:

  1. Ensure the Remote Tunnels extension is installed.
  2. Sign in with the same GitHub account used in the notebook.
  3. Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
  4. Run Remote Tunnels: Connect to Tunnel... and select your notebook's tunnel.

You're now seamlessly connected to Colab/Kaggle through VS Code!

🧩 Default Extensions Installed

By default, vscode-colab installs the following Visual Studio Code extensions to enhance your Python and Jupyter development experience:

  • Python Path: Facilitates generating internal import statements within a Python project.

  • Black Formatter: Provides code formatting support for Python files using the Black code formatter.

  • isort: Offers import sorting features to improve the readability of your Python code.

  • Python: Adds rich support for the Python language, including IntelliSense, linting, debugging, and more.

  • Pylance: Enhances Python language support with fast, feature-rich language services powered by Pyright.

  • Debugpy: Enables debugging capabilities for Python applications within VS Code.

  • Jupyter: Provides support for Jupyter notebooks, including interactive programming and computing features.

  • Jupyter Keymap: Aligns notebook keybindings in VS Code with those in Jupyter Notebook for a consistent experience.

  • Jupyter Notebook Renderers: Provides renderers for outputs of Jupyter Notebooks, supporting various output formats.

  • TensorBoard: Allows launching and viewing TensorBoards directly within VS Code.

⚠️ Important Notes

  • Closing the notebook tab will terminate the connection.
  • Kaggle Clipboard Limitation: On Kaggle, the copy-to-clipboard button will display "Copy Failed" in red due to sandbox restrictions. Manually select and copy the displayed code.

🧪 Testing

To run tests:

git clone https://github.com/EssenceSentry/vscode-colab.git
cd vscode-colab
pip install -r requirements-dev.txt
pytest

🛠️ Development

  • Configuration via setup.cfg
  • Development dependencies listed in requirements-dev.txt
  • Contributions welcome—open a GitHub issue or PR!

📄 License

MIT License. See LICENSE.

🙏 Acknowledgments

Special thanks to the developers behind VS Code Remote Tunnels for enabling this seamless remote development experience.

Metadata

Release files for vscode-colab 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vscode-colab 0.3.1
File Size Uploaded Provenance Actions
vscode_colab-0.3.1.tar.gz 41.0 kB Without provenance Details for vscode_colab-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vscode-colab 0.3.1
File Interpreter ABI Platform Actions
vscode_colab-0.3.1-py3-none-any.whl Python 3 none any Details for vscode_colab-0.3.1-py3-none-any.whl

Total release size: 74.1 kB

Release files / vscode_colab-0.3.1.tar.gz

Download URL vscode_colab-0.3.1.tar.gz
Size 41.0 kB
Tags Source
SHA-256 checksum
How to use checksums
20be147a5656b308d8e347a9bffc472b3947ca462cf2c871fd40964a95ed7f14
BLAKE2b-256 checksum
How to use checksums
097a8ef08b96e33b57e6643d9960678f9464d16acc06f0b88dfa1eeab78809a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / vscode_colab-0.3.1-py3-none-any.whl

Download URL vscode_colab-0.3.1-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e888009fa90d65005cbdca8c12a26d2ade7ad99372e8e604ec07b8e6a40534b
BLAKE2b-256 checksum
How to use checksums
ae6088d5a8b5d17cd4f09d6bed3d6791f8f4fa54545d0ef03b6578f9879340fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for vscode-colab 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page