-
Notifications
You must be signed in to change notification settings - Fork 140
Add environment module support #11343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
E2E Tests 🚀 |
| /** | ||
| * Detect if a module system is available and determine its type. | ||
| */ | ||
| export async function detectModuleSystem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did brew install modules, which told me to add source /opt/homebrew/opt/modules/init/zsh to my .zshrc. Consequently I think this function can't find my installation. Is it too bash-centric right now? Might there be a more generic way to check, like looking for $MODULEPATH or something?
This change adds environment module support to Positron.
It is not generally possible for us to know a priori what module environments the user wants to use, and which languages they intend to use with them; attempting to scan for modules and find all possible R/Python environments that could be affected would result in a whole lot of noise. Consequently, this feature does not work without explicit configuration. The configuration looks like this:
For each environment you need to specify:
For convenience, there is a Manage Module Environments command that can be used to walk you through setting up a configuration the first time, and a diagnostics report that shows the current state.
All of the implementation here happens on the extension side; a new
positron-environment-modulesextension provides the settings and commands, and an API that other extensions can use to query for module environments.As far as actually loading the modules, this change takes advantage of a new supervisor feature added recently to support conda; we just tell the supervisor to run
module load ...in the shell before starting the kernel. posit-dev/kallichore#55The grossest part of this change is in
positron-python; because the native locator (PET) doesn't know about environment modules, we need need to run a separate, typescript-based discovery pass to discover Python installations in named module environments, and aggregate the results with those from the native locator.Release Notes
New Features
Bug Fixes
QA Notes
module loadcommands are only run in R/Python kernels (i.e. consoles and notebooks). In regular terminals, or in commands run directly by extensions, the modules are not loaded. We're discussing how best to address this as it's a general problem that also affects conda, pixi, etc./opt/software, and then adding a module that puts it on the$PATH(etc).$PATH. If it does not do this, the otherwise default version of the interpreter will be discovered (e.g. the system version). This may be what you want in some circumstances as modules can also be used to pull in env vars for auth or otherwise setup an environment.