Skip to content
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

feat: make disabling extensions configurable (and disable dash) #842

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions solara/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import solara
import solara.routing
import solara.settings
import solara.server.settings
from solara.lab import cookies as solara_cookies
from solara.lab import headers as solara_headers

Expand Down Expand Up @@ -66,6 +67,8 @@ def get_jinja_env(app_name: str) -> jinja2.Environment:
"jupyter-js/extension",
"jupyter-js-widgets/extension",
"jupyter_dash/main",
"dash/main",
*solara.server.settings.server.ignore_nbextensions,
]


Expand Down
10 changes: 10 additions & 0 deletions solara/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ class Config:
HOST_DEFAULT = "localhost"


class Server(BaseSettings):
ignore_nbextensions: List[str] = []

class Config:
env_prefix = "solara_server_"
case_sensitive = False
env_file = ".env"


class MainSettings(BaseSettings):
use_pdb: bool = False
mode: str = "production"
Expand All @@ -181,6 +190,7 @@ class Config:


main = MainSettings()
server = Server()
theme = ThemeSettings()
telemetry = Telemetry()
ssg = SSG()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ $ curl http://localhost:8765/resourcez\?verbose

The JSON format may be subject to change.

## Ignoring notebook extensions

Not all (classic) jupyter notebook extensions are compatible with Solara, and there is not way to distinguish between notebook extensions that are needed for widgets and those that are not.
To ignore notebook extensions, you can set the `SOLARA_SERVER_IGNORE_NBEXTENSIONS` environment variable. This is a comma separated list of notebook extensions to ignore. For example, to ignore the `dash/main` and `foo/bar` extensions, you can run:

```bash
$ SOLARA_SERVER_IGNORE_NBEXTENSIONS="dash/main,foo/bar" solara run nogit/sol.py -a
```

Note that these error are not fatal, and the Solara app will still run.

## Production mode

Expand Down
9 changes: 9 additions & 0 deletions solara/website/pages/documentation/faq/content/99-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,12 @@ If you upgrade from an older version to 1.30 or later, the order in which pip in
```bash
$ pip install solara-server --force-reinstall
```

# I see an error in the browser console

If you see an error like this in the browser console:
```
Uncaught Error: Script error for "base/js/namespace", needed by: /jupyter/nbextensions/dash/main.js
```

See [ignoring notebook extensions](/documentation/advanced/understanding/solara-server#ignoring-notebook-extensions) for more information.
Loading