Skip to content

Feature Request Black for JupyterLab #2

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

Closed
agoertz-fls opened this issue Aug 9, 2023 · 10 comments
Closed

Feature Request Black for JupyterLab #2

agoertz-fls opened this issue Aug 9, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@agoertz-fls
Copy link

Hi,
first I have to thank you for this grate GPU enabled images.
I was wondering if you could add a code-formatter preferably black to the jupyterlab instance. I found that there is a python-lsp-black for the Language Server but I did not manage to get it running from within the image and the docker image building process currently fails on my machine. It would be really nice to have an easy option to reformat cells in the notebook automatically.

Kind regards,
Alex

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

Hi, first I have to thank you for this grate GPU enabled images.

You are welcome.

I was wondering if you could add a code-formatter preferably black to the jupyterlab instance.

Use the images with the devtools subtag, e.g. glcr.b-data.ch/jupyterlab/cuda/python/scipy:latest-devtools.

&& code-server --extensions-dir ${CODE_BUILTIN_EXTENSIONS_DIR} --install-extension ms-python.black-formatter \

Those include extension Black Formatter.

@agoertz-fls
Copy link
Author

Oh, nice but this will require me to use the code server instance right? I tried this but the last time it was't able to open my ipynb files, it showed the markdown outline, but the code was never displayed, so I was hoping for an extension that somehow works with the jupyterlab instance.

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

Oh, nice but this will require me to use the code server instance right?

Yes.

I tried this but the last time it was't able to open my ipynb files, it showed the markdown outline, but the code was never displayed, so I was hoping for an extension that somehow works with the jupyterlab instance.

Most likely you are not using HTTPS. This is required for Jupyter notebooks.
ℹ️ Fully qualified domain name (FQDN) required, too. TLS for an IP is not sufficient.

HTTP only works for 127.0.0.1 / localhost.

Cross references:

@agoertz-fls
Copy link
Author

Most likely you are not using HTTPS. This is required for Jupyter notebooks.
information_source Fully qualified domain name (FQDN) required, too. TLS for an IP is not sufficient.

Yeah I guess this might be the issue as this is behind the firwall up until now I was not bothering with Transport encryption but I will try to set something up to handle TLS, I guess a reverse proxy infront of the docker exposed port will be the easiest option.

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

I found that there is a python-lsp-black for the Language Server but I did not manage to get it running from within the image

About customisation:

  1. https://github.com/b-data/jupyterlab-python-docker-stack/blob/main/NOTES.md#customise
  2. Python LSP Server: https://github.com/jupyter-lsp/jupyterlab-lsp#configuring-the-servers

ℹ️ JupyterLab: You should be able to modify at runtime via Settings > Advanced Settings Editor [> JSON Settings Editor].

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

Need to fix

Should be "@jupyter-lsp/jupyterlab-lsp:plugin": {.

ℹ️ Otherwise the override has no effect.

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

I will try to set something up to handle TLS

-e GEN_CERT=yes - Instructs the startup script to generate a self-signed SSL certificate. Configures Jupyter Server to use it to accept encrypted HTTPS connections.

Common Features — Docker Stacks documentation > Additional runtime configurations

Use start-notebook.sh --ServerApp.certfile=~/.local/share/jupyter/notebook.pem as command (without -e GEN_CERT=yes) for further runs if your home directory is persistent.

Common Features — Docker Stacks documentation > SSL Certificates

@benz0li benz0li self-assigned this Aug 9, 2023
@benz0li benz0li added help wanted Extra attention is needed question Further information is requested labels Aug 9, 2023
@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

Fixed /usr/local/share/jupyter/lab/settings/overrides.json: 1a19836

@benz0li
Copy link
Member

benz0li commented Aug 9, 2023

@agoertz-fls Please close this issue if my information has helped you configuring black (formatter) in JupyterLab and enable TLS encryption.

Thank you.

@agoertz-fls
Copy link
Author

Thanks a lot, I will try to customize the image based on that information, if someone comes across this and writes a nice tutorial how to use your images as a base and customize on it by installing additional python packages and overwrites like the one above would be great, I guess I won't find the time in the foreseeable future.
Thanks a lot for this quick and helpful support.

@benz0li benz0li added enhancement New feature or request and removed help wanted Extra attention is needed question Further information is requested labels Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants