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)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
version |
str | required | Python version to switch to (e.g., "3.11") |
install_uv |
bool | False | Install uv package manager after switching |
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 colab-env-switcher
# Import and use
from colab_env_switcher import switch_python_version
# Switch to Python 3.11
switch_python_version("3.11")
# Verify the version
import sys
print(sys.version)
# Reinstall your required packages
!pip install numpy pandas matplotlib
Important Notes
⚠️ After switching Python versions:
- You need to reinstall all required packages
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colab_env_switcher-0.1.3.tar.gz.
File metadata
- Download URL: colab_env_switcher-0.1.3.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5c9f35c84bd674f5c1f54cc6408e0ad4b1b3faae22a8d6f5a9a2b10f167c29
|
|
| MD5 |
d924948b389c4d78179065d05c204135
|
|
| BLAKE2b-256 |
55c34d1d80a9a25d2c8ffef40a01e5e29349364a94dd68f7b77cc84b2eeab37d
|
File details
Details for the file colab_env_switcher-0.1.3-py3-none-any.whl.
File metadata
- Download URL: colab_env_switcher-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
562641e09011cb01afe1e5e25b4ee0d4911dfbaa17e22acbe482db257d59c6d2
|
|
| MD5 |
4bbcf637b7244ec209413dce7ff40cfc
|
|
| BLAKE2b-256 |
cbb0fe9cc3ba9160f8fd3507df6359d4791db4e80c5655b795bc215786f341af
|