Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Smart Conda WorkspaceNew to Visual Studio Code? Get it now.
Smart Conda Workspace

Smart Conda Workspace

Antonio Demarcus

|
6 installs
| (0) | Free
Minimal workspace configuration and versioning for conda projects
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Smart Conda Workspace

Smart Conda Workspace

Minimal VS Code extension for automated conda environment workspace configuration and project versioning.

Features

  • One-Click Workspace Configuration: Automatically configure VS Code workspace with conda environment integration
  • Environment Selection: Choose from any available conda environment
  • Multi-Platform Support: Works on Windows (PowerShell), macOS (zsh/bash), and Linux (bash)
  • Shell Auto-Activation: Automatically activates conda environment when entering project directory
  • Multi-Project Support: Works with Python, Node.js, and mixed projects
  • Version Management: Integrated project version updates with changelog generation
  • Zero Configuration: Works out of the box with existing conda setups

Quick Start

Prerequisites

  • VS Code 1.70.0 or higher
  • Conda (Miniconda/Anaconda) installed and configured
  • At least one conda environment available
  • Node.js 16.0.0 or higher (for version management)

Project Structure Example

Minimal Python Project Structure

For the extension to work optimally, your Python project should have this basic structure:


my-python-project/
├── scripts/
│
└── update-version.js # Required for version management
├── package.json # Required for version tracking
├── pyproject.toml # Alternative to package.json
├── environment.yml # Conda environment definition
├── src/
│		│
│		└── my_package/
├── **init**.py
│
└── main.py
├── tests/
│ 	│
│ 	└── test_main.py
├── README.md
└── .gitignore



**Key files for extension functionality:**
- scripts/update-version.js - Version management script
- package.json - Version tracking and project metadata
- environment.yml - Conda environment specification (optional)

Installation

  1. Install the extension:

    code --install-extension smart-conda-workspace-1.0.1.vsix
    
  2. Open your project in VS Code

  3. Configure workspace: Ctrl+Shift+P → "Smart Conda: Configure Workspace"

Commands

Configure Workspace

  • Command: Smart Conda: Configure Workspace
  • Shortcut: Ctrl+Shift+P → type "configure workspace"
  • Description: Creates optimized VS Code workspace configuration with shell auto-activation

What it does:

  1. Scans available conda environments
  2. Lets you select the environment for your project
  3. Detects project type (Python/Node.js/Mixed)
  4. Generates .code-workspace file with optimized settings
  5. Configures shell auto-activation (new feature)
  6. Creates backup of shell configuration

Update Project Version

  • Command: Smart Conda: Update Project Version
  • Shortcut: Ctrl+Shift+P → type "update version"
  • Description: Manages project versioning using existing scripts

Requirements:

  • scripts/update-version.js must exist in your project
  • package.json or pyproject.toml with version field

What it does:

  1. Reads current version from project files
  2. Shows version increment options (patch/minor/major)
  3. Executes your project's scripts/update-version.js
  4. Updates version files and generates changelog

Workflow Example

# 1. Open your project
cd /path/to/your/project
code .

# 2. Configure workspace (Ctrl+Shift+P)
Smart Conda: Configure Workspace
├── Select conda environment: "my-env"
├── Select project type: "Python"
├── ✅ Workspace file created
└── ✅ Shell auto-activation configured

# 3. Close and reopen from workspace file
# Environment now auto-activates when entering project directory

# 4. Update version when needed (Ctrl+Shift+P)
Smart Conda: Update Project Version
├── Current: 1.0.0
├── Select: "minor" → 1.1.0
└── ✅ Version updated + changelog

Shell Auto-Activation

The extension automatically configures your shell to activate the conda environment when you enter the project directory.

Supported Platforms:

Platform Shell Configuration File
Windows PowerShell ~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1
macOS zsh ~/.zshrc
macOS bash ~/.bash_profile or ~/.bashrc
Linux bash ~/.bashrc

Example Configuration Added:

For Unix systems (macOS/Linux):

# *my-project* - Auto-activation
# Generated by Smart Conda Workspace on [timestamp]
my_project() {
    if [[ "$PWD" == *"/path/to/my-project"* ]]; then
        conda activate my-env 2>/dev/null || true
    fi
}

# ZSH integration
if [[ -n "$ZSH_VERSION" ]]; then
    chpwd_functions+=(my_project)
    my_project  # Activate now
fi

For Windows PowerShell:

# *my-project* - Auto-activation
function my_project {
    $currentPath = Get-Location
    if ($currentPath.Path -like "*C:\path\to\my-project*") {
        conda activate my-env
    }
}
# Auto-trigger on directory change

Generated Workspace Structure

After running "Configure Workspace", you'll get:

your-project.code-workspace
{
  "folders": [{ "path": "." }],
  "settings": {
    "python.defaultInterpreterPath": "/path/to/conda/envs/your-env/bin/python",
    "python.condaPath": "/path/to/conda/bin/conda",
    "python.terminal.activateEnvironment": true,
    "terminal.integrated.defaultProfile.osx": "conda-env"
  },
  "extensions": {
    "recommendations": [
      "ms-python.python",
      "ms-python.vscode-pylance"
    ]
  }
}

Project Type Configurations

Python Projects

  • Settings: Black formatter, Pylint, pytest integration
  • Extensions: Python, Pylance, Black formatter, Jupyter
  • Terminal: Auto-activates conda environment

Node.js Projects

  • Settings: Prettier, TypeScript support, auto-imports
  • Extensions: Prettier, TypeScript, Tailwind CSS
  • Terminal: Node.js + conda environment

Mixed Projects

  • Settings: Combined Python + Node.js configuration
  • Extensions: Both Python and Node.js development tools
  • Terminal: Full stack development ready

Environment Detection

The extension automatically detects:

  • Available conda environments via conda env list
  • Current active environment (shown first in selection)
  • Python versions for each environment
  • Project type based on files (package.json, pyproject.toml, etc.)
  • Platform-specific paths (Windows vs Unix)

Integration with Existing Scripts

This extension integrates with project scripts:

  • scripts/update-version.js: Called for version management
  • package.json: Read for current version and metadata
  • pyproject.toml: Alternative version source for Python projects
  • environment.yml: Conda environment configuration

Note: The update-version.js script must exist in each project where you want version management, not in the extension itself.

Requirements

For Workspace Configuration:

  • Any conda environment available
  • Write permissions in project directory
  • Shell configuration file write permissions

For Version Updates:

  • scripts/update-version.js script in your project
  • package.json or pyproject.toml with version field
  • Git repository (optional, for automatic commits)

Troubleshooting

"No conda environments found"

  • Ensure conda is installed and in PATH
  • Run conda env list in terminal to verify
  • Check conda initialization in shell configuration

"update-version.js not found"

  • Ensure scripts/update-version.js exists in your project root (not in the extension)
  • Check file permissions
  • Script must be executable Node.js file

"Extension commands not showing"

  • Reload VS Code window: Ctrl+Shift+P → "Developer: Reload Window"
  • Check extension is enabled in Extensions panel
  • Ensure you have a workspace folder open

Shell auto-activation not working

  • Restart your terminal or run: source ~/.zshrc (Unix) or restart PowerShell (Windows)
  • Check that the function was added to your shell configuration file
  • Verify conda is properly initialized in your shell

Package.json Structure for Version Management

To use the "Update Project Version" command, your package.json must include:

{
  "name": "your-project-name",
  "version": "1.0.0",
  "description": "Your project description",
  "scripts": {
    "version:patch": "node scripts/update-version.js patch",
    "version:minor": "node scripts/update-version.js minor",
    "version:major": "node scripts/update-version.js major"
  },
  "author": "Your Name",
  "license": "MIT"
}

Required fields:

  • name: Project identifier
  • version: Current version (semantic versioning)
  • description: Project description

Recommended fields:

  • scripts: npm scripts for version management
  • author: Project author
  • license: License type

Note: Even for Python-only projects, a minimal package.json is required for version management functionality.

Platform-Specific Notes

Windows

  • Requires PowerShell (PowerShell 5.x or 7.x supported)
  • Creates PowerShell profile if it doesn't exist
  • Uses Windows-style paths and commands

macOS/Linux

  • Supports zsh and bash shells
  • Uses Unix-style paths and conda activation
  • Integrates with existing shell functions

Manual Configuration

If automatic detection fails, you can manually:

  1. Check conda setup:

    conda --version
    conda env list
    
  2. Verify project structure:

    ls -la scripts/update-version.js
    cat package.json | grep version
    
  3. Test extension manually:

    • Open Command Palette: Ctrl+Shift+P
    • Type: "Smart Conda"
    • Select available commands

License

MIT License - feel free to modify and distribute.

Contributing

  1. Fork the repository
  2. Create feature branch
  3. Make changes in vscode-extension/ directory
  4. Test with F5 (Run Extension)
  5. Submit pull request

Support

For issues and feature requests:

  • Check troubleshooting section above
  • Verify prerequisites are met
  • Create detailed issue report with:
    • VS Code version
    • Operating system
    • Conda version
    • Project structure
    • Error messages

Smart Conda Workspace - Streamline your conda-based development workflow across all platforms!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft