Skip to content

rendering .py notebook with Voila causes 403 error with Jupytext installed #1518

Open
@ctcjab

Description

@ctcjab

https://voila.readthedocs.io/en/stable/customize.html#run-scripts says:

Using Jupytext is another way to support script files. After installing jupytext, Voilà will see script files as if they are notebooks, and requires no extra configuration.

However, with both Voila and Jupytext installed, using Voila to render a .py notebook results in (a redirect to the static handler which in turn throws) a 403 error.

Based on the docs above, I believe the intention is for things to Just Work when following the reproduction steps below. In the meantime, what's the simplest possible way to get this to work? Thanks in advance!

Reproduction steps:

  1. uv venv tmp/voila-env
  2. source tmp/voila-env/bin/activate
  3. uv pip install jupyterlab voila jupytext [1]
  4. jupyter lab
  5. Jupyter opens in browser
  6. Click Jupytext's "Python - Percent Format" button in the Launcher
  7. Activate "Open with Voila in new browser tab":
Image 8. http://localhost:8888/voila/files/foo.py opens in a new tab (redirected from /voila/render/foo.py) with the "403 Forbidden" page: Image

[1] Here is the output showing the versions of everything installed:

Using Python 3.12.9 environment at: tmp/voila-env
Resolved 98 packages in 4.26s
Prepared 21 packages in 5.15s
Installed 98 packages in 915ms
 + anyio==4.8.0
 + appnope==0.1.4
 + argon2-cffi==23.1.0
 + argon2-cffi-bindings==21.2.0
 + arrow==1.3.0
 + asttokens==3.0.0
 + async-lru==2.0.4
 + attrs==25.1.0
 + babel==2.17.0
 + beautifulsoup4==4.13.3
 + bleach==6.2.0
 + certifi==2025.1.31
 + cffi==1.17.1
 + charset-normalizer==3.4.1
 + comm==0.2.2
 + debugpy==1.8.12
 + decorator==5.2.1
 + defusedxml==0.7.1
 + executing==2.2.0
 + fastjsonschema==2.21.1
 + fqdn==1.5.1
 + h11==0.14.0
 + httpcore==1.0.7
 + httpx==0.28.1
 + idna==3.10
 + ipykernel==6.29.5
 + ipython==9.0.0
 + ipython-pygments-lexers==1.1.1
 + isoduration==20.11.0
 + jedi==0.19.2
 + jinja2==3.1.5
 + json5==0.10.0
 + jsonpointer==3.0.0
 + jsonschema==4.23.0
 + jsonschema-specifications==2024.10.1
 + jupyter-client==8.6.3
 + jupyter-core==5.7.2
 + jupyter-events==0.12.0
 + jupyter-lsp==2.2.5
 + jupyter-server==2.15.0
 + jupyter-server-terminals==0.5.3
 + jupyterlab==4.3.5
 + jupyterlab-pygments==0.3.0
 + jupyterlab-server==2.27.3
 + jupytext==1.16.7
 + markdown-it-py==3.0.0
 + markupsafe==3.0.2
 + matplotlib-inline==0.1.7
 + mdit-py-plugins==0.4.2
 + mdurl==0.1.2
 + mistune==3.1.2
 + nbclient==0.10.2
 + nbconvert==7.16.6
 + nbformat==5.10.4
 + nest-asyncio==1.6.0
 + notebook-shim==0.2.4
 + overrides==7.7.0
 + packaging==24.2
 + pandocfilters==1.5.1
 + parso==0.8.4
 + pexpect==4.9.0
 + platformdirs==4.3.6
 + prometheus-client==0.21.1
 + prompt-toolkit==3.0.50
 + psutil==7.0.0
 + ptyprocess==0.7.0
 + pure-eval==0.2.3
 + pycparser==2.22
 + pygments==2.19.1
 + python-dateutil==2.9.0.post0
 + python-json-logger==3.2.1
 + pyyaml==6.0.2
 + pyzmq==26.2.1
 + referencing==0.36.2
 + requests==2.32.3
 + rfc3339-validator==0.1.4
 + rfc3986-validator==0.1.1
 + rpds-py==0.23.1
 + send2trash==1.8.3
 + setuptools==75.8.2
 + six==1.17.0
 + sniffio==1.3.1
 + soupsieve==2.6
 + stack-data==0.6.3
 + terminado==0.18.1
 + tinycss2==1.4.0
 + tornado==6.4.2
 + traitlets==5.14.3
 + types-python-dateutil==2.9.0.20241206
 + typing-extensions==4.12.2
 + uri-template==1.3.0
 + urllib3==2.3.0
 + voila==0.5.8
 + wcwidth==0.2.13
 + webcolors==24.11.1
 + webencodings==0.5.1
 + websocket-client==1.8.0
 + websockets==15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions