posit-dev / posit-dev/positron

Environment Modules: Run `purge` before `load`

Open
#14,744 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: runtimes support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

Today, an R or Python session that uses Environment Modules always starts by doing module load. However, it should probably be doing a module purge first.

Paraphrasing:

When switching between module based sessions, Positron is not doing ml purge && ml load new_module, it is simply doing ml load new_module. This means that the new env is just updating the list of modules the “new_module” needs, and sometimes, depending on the module configuration, some leftover modules are left in the env... Make sure that prior to a ml load there’s always a ml purge before.

Of course, a downside to this approach is that if you have modules loading in your shell startup scripts, purging will unload them which might not be what you want. We could make the purge optional; on by default but you can disable via:

{
    "positron.environmentModules.environments": {
        "R 4 Stable": {
            "languages": ["r"],
            "modules": ["R/4.4.2", "other/version"],
            "purge": false
        },
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Environment Modules handling and the environment configuration schema or entry point, then trace where module load is invoked for R and Python sessions. Done means purge runs before load by default, while the per-environment purge setting can disable it; verify the behavior with the relevant existing checks or session startup flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, r, shell, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.