LSP Servers
Glass supports multiple Python language servers:- Basedpyright (Default)
- Pyright
- Ty (Experimental)
- Ruff (Linter)
A faster fork of Pyright with improved performance:
- Full type checking
- Intelligent completions
- Go-to-definition and references
- Automatic import suggestions
- Inlay hints for types
Virtual Environment Detection
Glass automatically detects and uses Python virtual environments:Detection Methods
- Project-local Environments
- Global Environments
- Custom Paths
Glass detects these virtual environments automatically:
- venv: Standard library
python -m venv - virtualenv: Third-party tool
- Poetry:
poetry installenvironments - Pipenv:
pipenv installenvironments - uv: Modern Python package manager
- Conda/Mamba: Anaconda environments
- Pixi: Modern package manager
- UV workspace environments
- UV project environments
- Poetry environments
- Pipenv environments
- venv/virtualenv
- Conda environments
Environment Priority
For workspaces with multiple packages:- Same directory as file
- Parent directories (closest first)
- Workspace root
Glass uses Python Environment Tools (PET) for environment detection, the same library used by VS Code.
Features
Intelligent Completions
- Methods & Functions
- Import Suggestions
- Type Hints
- Method signatures with parameter types
- Return type annotations
- Docstrings
Custom Completion Sorting
Glass customizes Pyright’s completion order:- Enum members
- Fields
- Properties
- Variables
- Constants
- Methods/Functions
- Classes
- Modules
Test Framework Integration
Glass provides built-in support for Python test frameworks:Test Runner Selection
Configure your preferred test runner:pytest (Default)
- File Tests
- Class Tests
- Single Test
Run all tests in a file:Glass automatically uses the active virtual environment’s Python.
unittest (Standard Library)
- File Tests
- Class Tests
- Single Test
Module Execution
Run Python files as modules:src/mypackage/cli.py→src.mypackage.climypackage/cli.py→mypackage.cli
Task Variables
| Variable | Description | Example |
|---|---|---|
PYTHON_ACTIVE_ZED_TOOLCHAIN | Active Python interpreter | /path/to/.venv/bin/python3 |
PYTHON_TEST_TARGET | Test target (pytest or unittest format) | test_file.py::TestClass::test_method |
PYTHON_MODULE_NAME | Module name from file path | mypackage.cli |
Available Tasks
- Execution
- Testing
- Execute selection: Run selected code
- Run file: Execute entire Python file
- Run module: Run file as module with
-m
Configuration
Language Server Configuration
- Pyright/Basedpyright
- Virtual Environment
off: No type checkingbasic: Basic type checking (default)strict: Strict type checking
Workspace Detection
Glass detects Python projects by findingpyproject.toml:
- Find the project root
- Detect package structure
- Configure relative imports
Conda/Mamba Support
For Conda environments:- Activation
- Environment Selection
Configure Conda manager preference:Glass will activate Conda environments in integrated terminals.
Troubleshooting
- Wrong Python Version
- Import Errors
- Tests Not Found
Check detected Python:
- Cmd/Ctrl+Shift+P → “Python: Show Detected Environments”
- Verify the correct environment is selected
- If not, use “Python: Select Interpreter”
Next Steps
- Configure Pyright type checking
- Learn about Poetry integration
- Explore Ruff configuration