Skip to content

feat: bundle reqstool with extension via managed venv #2

@jimisola

Description

@jimisola

Summary

Currently users must manually install reqstool before the extension works:

pipx install "reqstool[lsp]"

This means the extension fails silently on first install for most users.

Proposed Solution

On activation, automatically install reqstool[lsp] from PyPI into a managed virtual environment stored in VS Code's globalStorageUri. This follows the same pattern used by Microsoft's Python tool extensions (vscode-pylint, vscode-black-formatter, vscode-mypy).

Resolution priority:

  1. If reqstool.serverCommand is explicitly user-configured → use it (no change)
  2. Otherwise → use managed venv (globalStorageUri/env/bin/reqstool lsp)
  3. If venv setup fails → fall back to PATH

Behaviour:

  • First activation: show progress notification while pip-installing reqstool[lsp]
  • Subsequent activations: venv already exists, starts immediately
  • Extension version upgrade: old venv is invalidated and recreated
  • Power users: set reqstool.serverCommand to any command to bypass the managed venv entirely

Implementation

  • ensureManagedVenv(context) in src/extension.ts: creates venv, runs pip install reqstool[lsp]
  • findPython(): tries python3 then python to locate a system interpreter
  • resolveServerCommand(managedBin?): respects explicit user config, falls back to managed venv, then PATH
  • No bundled wheels — always fetches from PyPI

References

Signed-off-by: jimisola jimisola@users.noreply.github.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions