Skip to main content

A Python environment switcher for Google Colab

Project description

Colab Environment Switcher

A simple Python library to easily switch Python versions in Google Colab environments.

Features

  • 🚀 Quick Python version switching in Google Colab
  • 📦 Automatic pip installation for the new Python version
  • ✅ Simple one-line API
  • 🔧 Optional uv package manager installation

Installation

From PyPI (Recommended)

# Install directly from PyPI
!pip install colab-env-switcher

From GitHub Release

# Install from GitHub Release wheel file
pip install https://github.com/911218sky/colab-env-switcher/releases/latest/download/colab_env_switcher-0.1.0-py3-none-any.whl

From GitHub Source

# Install latest version from GitHub source
!pip install git+https://github.com/911218sky/colab-env-switcher.git

Local Development

pip install -e .

Usage

Basic Usage

from colab_env_switcher import switch_python_version

# Switch to Python 3.11
switch_python_version("3.11")

With uv Package Manager

from colab_env_switcher import switch_python_version

# Switch to Python 3.10 and install uv
switch_python_version("3.10", install_uv=True)

Supported Python Versions

  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10
  • Python 3.11
  • Python 3.12
  • Python 3.13 (if available)
  • Python 3.14 (experimental, if available)

Note: Newer Python versions (3.13+) may have limited package availability. For production use, we recommend Python 3.10-3.12.

Example in Colab

# Install the library
!pip install git+https://github.com/911218sky/colab-env-switcher.git

# Import and use
from colab_env_switcher import switch_python_version

# Switch to Python 3.11
switch_python_version("3.11")

# Verify the version
!python --version

# Reinstall your required packages
!pip install numpy pandas matplotlib

Important Notes

⚠️ After switching Python versions:

  • The environment will be reset
  • You need to reinstall all required packages
  • Runtime restart is not required

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colab_env_switcher-0.1.2.post1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colab_env_switcher-0.1.2.post1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file colab_env_switcher-0.1.2.post1.tar.gz.

File metadata

File hashes

Hashes for colab_env_switcher-0.1.2.post1.tar.gz
Algorithm Hash digest
SHA256 4be1577e6acd9596ec0f85a16ef95a415d71305e3e6c444cee1c9b3bdf84e271
MD5 c240671b1fffec1b1966c443a295b859
BLAKE2b-256 7e56c74545640317a661a1025383e6facb3fa641adfe6ad4383f84bcb66fdd4b

See more details on using hashes here.

File details

Details for the file colab_env_switcher-0.1.2.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for colab_env_switcher-0.1.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 2729087b7c2b59dc6326aa799ba2bccf310fefa40897edfc0870b0489b499fba
MD5 17297493e5b6ca97ceeb8c02506178ff
BLAKE2b-256 9792a282a0f260ebacb04b0d048f240462d8bb6cbbabe9d586c54a798f0c4a3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page