Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: add packaging to pyproject.toml top-level (#2859)

Myles Scolnick5f32b13bc57f
diff --git a/frontend/src/core/wasm/worker/bootstrap.ts b/frontend/src/core/wasm/worker/bootstrap.ts
index 959c104f31..d9ad097182 100644
--- a/frontend/src/core/wasm/worker/bootstrap.ts
+++ b/frontend/src/core/wasm/worker/bootstrap.ts
@@ -147,9 +147,11 @@ export class DefaultWasmController implements WasmController {
const foundPackages = new Set<string>(packages.toJs());
- // Fire and forgot load packages and instantiation
+ // Fire and forget:
+ // Load notebook dependencies and instantiate the session
// We don't want to wait for this to finish,
- // as it blocks the initial code from being shown.
+ // so we can show the initial code immediately giving
+ // a sense of responsiveness.
void this.loadNotebookDeps(code, foundPackages).then(() => {
return init(userConfig.runtime.auto_instantiate);
});
@@ -200,8 +202,9 @@ export class DefaultWasmController implements WasmController {
import sys
# Filter out builtins
missing = [p for p in ${JSON.stringify(missingPackages)} if p not in sys.modules]
- print("Loaded from micropip:", missing)
- await micropip.install(missing)
+ if len(missing) > 0:
+ print("Loading from micropip:", missing)
+ await micropip.install(missing)
`)
.catch((error) => {
// Don't let micropip loading failures stop the notebook from loading
diff --git a/pyproject.toml b/pyproject.toml
index d78a47f7dc..5b142ace38 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -345,7 +345,7 @@ docstring-code-format = true
ban-relative-imports = "all"
# Ban certain modules from being imported at module level, instead requiring
# that they're imported lazily (e.g., within a function definition).
-banned-module-level-imports = ["numpy", "pandas", "tomlkit", "polars", "altair", "ipython", "anywidget"]
+banned-module-level-imports = ["numpy", "pandas", "tomlkit", "polars", "altair", "ipython", "anywidget", "packaging"]
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false