ryantam626 / jupyterlab_code_formatter

A JupyterLab plugin to facilitate invocation of code formatters.
MIT License
822 stars 52 forks source link

404 on jupyter image #310

Closed smiecj closed 1 year ago

smiecj commented 1 year ago

Hi, I just run jupyter container docker run -it -p 8888:8888 jupyter/scipy-notebook:lab-3.6.3 , then install formatter:

pip install jupyterlab-code-formatter
pip install black
pip install yapf
pip install isort
pip install autopep8

But when click "format" button, it announce 404 problem:

image

curl param copy from chrome:

curl 'http://.../jupyterlab_code_formatter/format?1684310976887' \
  -H 'Accept: */*' \
...
  --data-raw '{"code":["print(123)"],"notebook":true,"formatter":"isort","options":{"multi_line_output":3,"include_trailing_comma":true,"force_grid_wrap":0,"use_parentheses":true,"ensure_newline_before_comments":true,"line_length":88}}' \
  --compressed \
  --insecure

Maybe my installation steps have some problem? Thanks in advance

ryantam626 commented 1 year ago

Hi, thanks for the report.

So to recap, you are doing

docker run -it -p 8888:8888 jupyter/scipy-notebook:lab-3.6.3

then within jupyterlab itself you do

pip install jupyterlab-code-formatter
pip install black
pip install yapf
pip install isort
pip install autopep8

?

I know what's the issue here if that's the case. You haven't done the step outlined here, you either need to modify the entrypoint such that these pypi packages are installed before jupyterlab is started or build upon the docker image you are using.

smiecj commented 1 year ago

Thanks! After I add example formatter like this in config.py, it fixed.