finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
7.72k stars 1.05k forks source link

python user guide broken #2560

Closed ekalosak closed 1 week ago

ekalosak commented 3 months ago

Bug Report

See https://perspective.finos.org/docs/python/, specifically the Torando websocket example index.html:

<perspective-viewer id="viewer" editable></perspective-viewer>

<script>
    window.addEventListener("DOMContentLoaded", async function () {
        // Create a client that expects a Perspective server
        // to accept connections at the specified URL.
        const websocket = perspective.websocket(
            "ws://localhost:8888/websocket"
        );

        // Get a handle to the Table on the server
        const server_table = websocket.open_table("data_source_one");

        // Create a new view
        const server_view = await table.view();

        // Create a Table on the client using `perspective.worker()`
        const worker = perspective.worker();
        const client_table = await worker.table(view);

        // Load the client table in the `<perspective-viewer>`.
        document.getElementById("viewer").load(client_table);
    });
</script>

Of course, table is not defined. Worse, server_table.view() is not a function.

Solution

The Tornado example works. Hard problem to keep the web guide snippets in sync with fast-moving codebase, for sure. But here's the details:

Specifics

  1. add worker in the guide
  2. await the open_table
  3. server_view from server_table, not table
  4. worker.table isn't a future
texodus commented 1 week ago

Appreciate the effort but we do not need issues for docs. They attract low-effort bikeshedding and are rarely worth the effort - e.g., the details of the report are about 10x the writing necessary to just submit the fix (even this response is more prose than the doc fix), and they're not correct (work.table is a Promise, open_table is synchronous on <3, etc).

@Aqina, stop spamming this project.