Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Stein <[email protected]>
  • Loading branch information
texodus committed Sep 29, 2024
1 parent 28a3101 commit f55d042
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 54 deletions.
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,15 @@ and/or [Jupyterlab](https://jupyterlab.readthedocs.io/en/stable/).
### Documentation

- [Project Site](https://perspective.finos.org/)
- User Guides
- [Javascript User Guide](https://perspective.finos.org/docs/js.html)
- [Python User Guide](https://perspective.finos.org/docs/python.html)
- [Developer Guide](https://perspective.finos.org/docs/development.html)
- Concepts
- [Table](https://perspective.finos.org/docs/table.html)
- [View](https://perspective.finos.org/docs/view.html)
- Language Guides and API Docs
- [Javascript](https://docs.rs/perspective-js/latest/perspective_js/)
- [JavaScript (`<perspective-viewer>`) API](https://perspective.finos.org/docs/obj/perspective-viewer/)
- [Python](https://docs.rs/perspective-python/latest/perspective_python/)
- [Rust](https://docs.rs/perspective-rs/latest/perspective_rs)
- Appendix
- [Data Binding](https://docs.rs/perspective-server/latest/perspective_server/)
- [Expression Columns](https://perspective.finos.org/docs/expressions.html)
- [Data Binding](https://perspective.finos.org/docs/table.html)
- API
- [Perspective API](https://github.com/finos/perspective/blob/master/packages/perspective/README.md)
- [Perspective Viewer API](https://perspective.finos.org/docs/obj/perspective-viewer/)
- [Perspective Python API](https://perspective.finos.org/docs/obj/perspective-python.html)
- [Developer Guide](https://perspective.finos.org/docs/development.html)

### Examples

Expand All @@ -65,22 +61,19 @@ and/or [Jupyterlab](https://jupyterlab.readthedocs.io/en/stable/).
<td><a href="https://github.com/timbess"><code>@timbess</code></a></td>
<td><a href="https://github.com/sc1f"><code>@sc1f</code></a></td>
</tr>
<tr><td>
<a href="https://www.youtube.com/watch?v=s6n9vEyM1gY"><img width="240" src="https://img.youtube.com/vi/s6n9vEyM1gY/0.jpg" /></a>
</td><td>
<a href="https://www.youtube.com/watch?v=lDpIu4dnp78"><img width="240" src="https://img.youtube.com/vi/lDpIu4dnp78/0.jpg" /></a>
</td><td>
<a href="https://www.youtube.com/watch?v=IO-HJsGdleE"><img width="240" src="https://img.youtube.com/vi/IO-HJsGdleE/0.jpg" /></a>
</td></tr>
<tr>
<td><a href="https://www.youtube.com/watch?v=v5Y5ftlGNhU"><img width="240" src="https://img.youtube.com/vi/v5Y5ftlGNhU/0.jpg" /></a></td>
<td><a href="https://www.youtube.com/watch?v=lDpIu4dnp78"><img width="240" src="https://img.youtube.com/vi/lDpIu4dnp78/0.jpg" /></a></td>
<td><a href="https://www.youtube.com/watch?v=0ut-ynvBpGI"><img width="240" src="https://img.youtube.com/vi/0ut-ynvBpGI/0.jpg" /></a></td>
</tr>
<tr>
<td><a href="https://github.com/texodus"><code>@texodus</code></a></td>
<td><a href="https://github.com/texodus"><code>@texodus</code></a></td>
<td></td>
</tr>
<tr><td>
<a href="https://www.youtube.com/watch?v=0ut-ynvBpGI"><img width="240" src="https://img.youtube.com/vi/0ut-ynvBpGI/0.jpg" /></a>
</td><td>
<a href="https://www.youtube.com/watch?v=no0qChjvdgQ"><img width="240" src="https://img.youtube.com/vi/no0qChjvdgQ/0.jpg" /></a>
</td><td>
</td></tr>
<tr>
<td><a href="https://www.youtube.com/watch?v=no0qChjvdgQ"><img width="240" src="https://img.youtube.com/vi/no0qChjvdgQ/0.jpg" /></a></td>
<td><a href="https://www.youtube.com/watch?v=IO-HJsGdleE"><img width="240" src="https://img.youtube.com/vi/IO-HJsGdleE/0.jpg" /></a></td>
<td></td>
</tr>
</tbody></table>
1 change: 0 additions & 1 deletion examples/jupyter-notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ For examples pertaining to `perspective-python` Tornado servers, check out:

- [tornado-python](https://github.com/finos/perspective/tree/master/examples/tornado-python): a simple Tornado server that delivers a static dataset to the user using `perspective-python` and `<perspective-viewer>`.
- [tornado-streaming-python](https://github.com/finos/perspective/tree/master/examples/tornado-streaming-python): a streaming Tornado server that demonstrates `perspective-python`'s high throughput and performance in streaming scenarios.
- [workspace-editing-python](https://github.com/finos/perspective/tree/master/examples/workspace-editing-python): a full-featured example using `<perspective-workspace>` that illustrates a deep and powerful integration between `<perspective-workspace>` and `perspective-python`.
52 changes: 28 additions & 24 deletions examples/jupyter-notebooks/table_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from perspective import Table\n",
"from perspective import table\n",
"from datetime import date, datetime\n",
"import numpy as np\n",
"import pandas as pd\n",
Expand All @@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -53,8 +53,8 @@
" \"float\": [i * 1.25 for i in range(4)],\n",
" \"str\": [\"a\", \"b\", \"c\", \"d\"],\n",
" \"bool\": [True, False, True, False],\n",
" \"date\": [date.today() for i in range(4)],\n",
" \"datetime\": [datetime.now() for i in range(4)]\n",
" \"date\": [date.today().timestamp() for i in range(4)],\n",
" \"datetime\": [datetime.now().timestamp() for i in range(4)]\n",
"}\n",
"\n",
"# Row-oriented\n",
Expand All @@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,28 +100,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "TypeError",
"evalue": "Object of type date is not JSON serializable",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# From a dataset\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m table \u001b[38;5;241m=\u001b[39m \u001b[43mtable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Or a dataframe\u001b[39;00m\n\u001b[1;32m 5\u001b[0m df_table \u001b[38;5;241m=\u001b[39m table(df)\n",
"File \u001b[0;32m~/work/perspective/rust/perspective-python/perspective/__init__.py:39\u001b[0m, in \u001b[0;36mtable\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(Client\u001b[38;5;241m.\u001b[39mtable)\n\u001b[1;32m 38\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mtable\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m---> 39\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mGLOBAL_CLIENT\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtable\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.10.14/lib/python3.10/json/__init__.py:231\u001b[0m, in \u001b[0;36mdumps\u001b[0;34m(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)\u001b[0m\n\u001b[1;32m 226\u001b[0m \u001b[38;5;66;03m# cached encoder\u001b[39;00m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;129;01mnot\u001b[39;00m skipkeys \u001b[38;5;129;01mand\u001b[39;00m ensure_ascii \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 228\u001b[0m check_circular \u001b[38;5;129;01mand\u001b[39;00m allow_nan \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 229\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m indent \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m separators \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 230\u001b[0m default \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m sort_keys \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n\u001b[0;32m--> 231\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_default_encoder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 232\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 233\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONEncoder\n",
"File \u001b[0;32m~/.pyenv/versions/3.10.14/lib/python3.10/json/encoder.py:199\u001b[0m, in \u001b[0;36mJSONEncoder.encode\u001b[0;34m(self, o)\u001b[0m\n\u001b[1;32m 195\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m encode_basestring(o)\n\u001b[1;32m 196\u001b[0m \u001b[38;5;66;03m# This doesn't pass the iterator directly to ''.join() because the\u001b[39;00m\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# exceptions aren't as detailed. The list call should be roughly\u001b[39;00m\n\u001b[1;32m 198\u001b[0m \u001b[38;5;66;03m# equivalent to the PySequence_Fast that ''.join() would do.\u001b[39;00m\n\u001b[0;32m--> 199\u001b[0m chunks \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterencode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mo\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_one_shot\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(chunks, (\u001b[38;5;28mlist\u001b[39m, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[1;32m 201\u001b[0m chunks \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(chunks)\n",
"File \u001b[0;32m~/.pyenv/versions/3.10.14/lib/python3.10/json/encoder.py:257\u001b[0m, in \u001b[0;36mJSONEncoder.iterencode\u001b[0;34m(self, o, _one_shot)\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 253\u001b[0m _iterencode \u001b[38;5;241m=\u001b[39m _make_iterencode(\n\u001b[1;32m 254\u001b[0m markers, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault, _encoder, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mindent, floatstr,\n\u001b[1;32m 255\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkey_separator, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mitem_separator, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msort_keys,\n\u001b[1;32m 256\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mskipkeys, _one_shot)\n\u001b[0;32m--> 257\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_iterencode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mo\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.pyenv/versions/3.10.14/lib/python3.10/json/encoder.py:179\u001b[0m, in \u001b[0;36mJSONEncoder.default\u001b[0;34m(self, o)\u001b[0m\n\u001b[1;32m 160\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdefault\u001b[39m(\u001b[38;5;28mself\u001b[39m, o):\n\u001b[1;32m 161\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Implement this method in a subclass such that it returns\u001b[39;00m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;124;03m a serializable object for ``o``, or calls the base implementation\u001b[39;00m\n\u001b[1;32m 163\u001b[0m \u001b[38;5;124;03m (to raise a ``TypeError``).\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 177\u001b[0m \n\u001b[1;32m 178\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 179\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mObject of type \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mo\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 180\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mis not JSON serializable\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"\u001b[0;31mTypeError\u001b[0m: Object of type date is not JSON serializable"
]
}
],
"source": [
"# From a dataset\n",
"table = Table(data)\n",
"table = table(data)\n",
"\n",
"# Or a dataframe\n",
"df_table = Table(df)\n",
"\n",
"# Or a CSV\n",
"csv_table = Table(csv)\n",
"\n",
"# tables can be created from schema\n",
"table2 = Table(schema)\n",
"assert table2.size() == 0\n",
"\n",
"# constructing a table with an index, which is a column name to be used as the primary key\n",
"indexed = Table(data, index=\"str\")\n",
"\n",
"# or a limit, which is a total cap on the number of rows in the table - updates past `limit` overwite at row 0\n",
"limited = Table(data, limit=2)"
"df_table = table(df)\n"
]
},
{
Expand Down Expand Up @@ -414,7 +418,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down
5 changes: 4 additions & 1 deletion rust/perspective-js/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
});
</script>
<style>
code.language-python,
code.language-bash,
code.language-xml,
code.language-javascript,
pre.language-javascript {
pre {
background-color: #2e2e2e;
}
pre code.hljs {
Expand Down
13 changes: 12 additions & 1 deletion rust/perspective-python/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@
hljs.highlightAll();
</script>
<style>
code.language-python,
code.language-bash,
code.language-xml,
code.language-javascript,
pre {
background-color: #2e2e2e;
}

pre code.hljs {
padding: 0;
}

pre.rust,
/* pre.language-javascript, */
div.rust,
div.javascript {
display: none;
Expand Down
4 changes: 2 additions & 2 deletions rust/perspective-server/src/local_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Drop for LocalClient {
tracing::error!("`Client` dropped without `Client::close`");
}
} else {
tracing::warn!("`Session` dropped before init");
tracing::debug!("`Session` dropped before init");
}
}
}
Expand All @@ -106,7 +106,7 @@ impl LocalClient {
if let Some(session) = self.0.session.get() {
session.write().await.take().unwrap().close().await
} else {
tracing::warn!("`Session` dropped before init");
tracing::debug!("`Session` dropped before init");
}
}
}

0 comments on commit f55d042

Please sign in to comment.