Skip to content

support "activating" gg environments by appending a single directory to PATH #247

Description

@DetachHead

the problem

in my projects i use pyprojectx, which is basically the same idea as gg but specific to python (it requires python to be installed globally and only supports installing tools from pypi). i've been looking for a language-agnostic alternative for a while so i'm glad to have finally found gg.

when installing a tool via pyprojectx, its executable gets installed to ./.pyprojectx/main, which means you can add that directory to your PATH to be able to run them without using the wrapper script:

export PATH="$PATH:./.pyprojectx/main"
./pw --add uv
uv --version

this allows me to configure vscode to do this, so that any tools required by my project are instantly made available in the PATH for all contributors, without them ever having to install anything globally or change their PATH manually:

// .vscode/settings.json
{
  "terminal.integrated.env.linux": {
    "PATH": "${env:PATH}:${workspaceFolder}/.pyprojectx/main"
  }
}

this is more difficult to do in gg because its tools are installed to separate directories, meaning this config would need to be updated when tools are added or updated.

(more info/context in the pyprojectx feature request: pyprojectx/pyprojectx#23)

proposed solution

i propose adding a .gg directory in the project root, which contains either symlinks or wrapper scripts to the correct versions of the tools defined in gg.toml. for example:

.
└── project_root/
    ├── .gg/
    │   ├── node
    │   ├── uv
    │   ├── uvw
    │   └── uvx
    ├── gg.cmd
    └── gg.toml

this allows us to add the following config to .vscode/settings.json:

// .vscode/settings.json
{
  "terminal.integrated.env.linux": {
    "PATH": "${env:PATH}:${workspaceFolder}/.gg"
  }
}

and now once a tool is installed via gg, it can be executed directly without the wrapper script:

./gg.cmd node --version
node --version # works!

this is also great for IDE integrations that expect certain tools to be available in the PATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions