posit-dev / posit-dev/positron
Environment Modules: Run `purge` before `load`
Nobody has claimed this yet.
- 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 doingml 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 aml loadthere’s always aml purgebefore.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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