danielfrg / s3contents

Jupyter Notebooks in S3 - Jupyter Contents Manager implementation
Apache License 2.0
248 stars 88 forks source link

User Folder in S3 Directory #69

Closed morganhferry closed 5 years ago

morganhferry commented 5 years ago

We are using S3Contents in conjunction with JupyterHub. We would like to be able to indicate in the prefix a username. Some sort of flag that picks up the user and creates their directory in S3 within their folder name. Is this already possible? IE in the /etc/jupyter/jupyter_notebook_config.py file:

c.S3ContentsManager.prefix = "$USER/jupyter_notebooks"

danielfrg commented 5 years ago

Yes, you can do it just in the jupyter_notebook_config.py:

import getpass
username = getpass.getuser()
...
c.S3ContentsManager.prefix = os.path.join(username, "jupyter_notebooks")
morganhferry commented 5 years ago

Ah, perfect. Thank you!