jupyterhub / jupyterhub/batchspawner
Allow setting PATH variable for each user dynamically
- Dominant language
- Python
- Stars
- 207
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
I have a conda environment per user in their home directory. so PATH needs to be something like `PATH=/home/{username}/conda/bin:$PATH`. However, currently there seems to be no way to do this, since username expansion isn't supported in environment files - plus PATH doesn't seem to be passed through to the spawned notebook (on Slurm at least)
### Proposed change
1. Allow username expansion via `{username}` or similar in PATH
2. Add a separate traitlet just for PATH, [similar to systemdspawner](https://github.com/jupyterhub/systemdspawner#extra_paths)
### Alternative options
Currently, I use the following to get what I want:
```python
class CustomSlurmSpawner(SlurmSpawner):
def start(self, *args, **kwargs):
self.req_prologue = f'export PATH=/home/{self.user.name}/conda/bin:$PATH'
return super().start(*args, **kwargs)
c.JupyterHub.spawner_class = CustomSlurmSpawner
```
### Who would use this feature?
People who have per-user conda environments
Contributor guide
Assessment
This issue has not been assessed yet.