Skip to content

Commit

Permalink
docs(support-matrix): replace the backend info streamlit app with a s…
Browse files Browse the repository at this point in the history
…tatic quarto dashboard
  • Loading branch information
cpcloud committed Feb 2, 2024
1 parent 097a1d7 commit 21c92e5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 247 deletions.
209 changes: 0 additions & 209 deletions docs/backends/app/backend_info_app.py

This file was deleted.

5 changes: 0 additions & 5 deletions docs/backends/app/requirements.txt

This file was deleted.

98 changes: 66 additions & 32 deletions docs/support_matrix.qmd
Original file line number Diff line number Diff line change
@@ -1,57 +1,91 @@
---
title: "Operation support matrix"
format: dashboard
hide:
- toc
---

# Operation support matrix
```{python}
#| echo: false
!python ../gen_matrix.py
```

We provide Ibis's operation support matrix as
a [Streamlit](https://streamlit.io/) app that shows supported operations for
each backend. Ibis defines a common API for analytics and data transformation
code that is transpiled to native code for each backend. Due to differences in
SQL dialects and upstream support for different operations in different
backends, support for the full breadth of the Ibis API varies.
```{python}
#| echo: false
import pandas as pd
support_matrix = pd.read_csv("./backends/raw_support_matrix.csv")
support_matrix = support_matrix.assign(
Category=support_matrix.Operation.map(lambda op: op.rsplit(".", 1)[0].rsplit(".", 1)[-1]),
Operation=support_matrix.Operation.map(lambda op: op.rsplit(".", 1)[-1]),
).set_index(["Category", "Operation"])
all_visible_ops_count = len(support_matrix)
coverage = pd.Index(
support_matrix.sum()
.map(lambda n: f"{n} ({round(100 * n / all_visible_ops_count)}%)")
.T
)
support_matrix.columns = pd.MultiIndex.from_tuples(
list(zip(support_matrix.columns, coverage)), names=("Backend", "API coverage")
)
support_matrix = support_matrix.replace({True: "✔", False: "🚫"})
```

## {height=25%}

::: {.card title="Welcome to the operation support matrix!"}

You can use this page to see which operations are supported on each backend.
This is a [Quarto dashboard](https://quarto.org/docs/dashboards/) that shows
the operations each backend supports.

Due to differences in SQL dialects and upstream support for different
operations in different backends, support for the full breadth of the Ibis API
varies.

::: {.callout-tip}
Backends with low coverage are good places to start contributing!

Each backend implements operations differently, but this is usually very similar to other backends. If you want to start contributing to ibis, it's a good idea to start by adding missing operations to backends that have low operation coverage.
:::

<div class="streamlit-app">
<iframe class="streamlit-app-inner" width=760 height=600 src="https://ibis-project.streamlit.app/?embedded=true"></iframe>
</div>

::: {.callout-note}
This app is built using [`streamlit`](https://streamlit.io/).

You can develop the app locally by editing `docs/backends/app/backend_info_app.py` and opening a PR with your changes.
:::

Test your changes locally by running
### {width=25%}

```sh
$ streamlit run docs/backends/app/backend_info_app.py
```{python}
#| content: valuebox
#| title: "Number of backends"
import ibis
dict(
value=len(ibis.util.backend_entry_points()),
color="info",
icon="signpost-split-fill",
)
```

The changes will show up in the dev docs when your PR is merged!
:::

## Raw Data
### {width=25%}

```{python}
#| echo: false
!python ../gen_matrix.py
#| content: valuebox
#| title: "Number of SQL backends"
import importlib
from ibis.backends.base.sql import BaseSQLBackend
sql_backends = sum(
issubclass(
importlib.import_module(f"ibis.backends.{entry_point.name}").Backend,
BaseSQLBackend
)
for entry_point in ibis.util.backend_entry_points()
)
dict(value=sql_backends, color="green", icon="database")
```

You can also download data from the above tables in [CSV format](./backends/raw_support_matrix.csv).

The code used to generate the linked CSV file is below.
## {height=70%}

```{python}
#| echo: false
#| output: asis
with open("../gen_matrix.py", mode="r") as f:
print(f"```python\n{f.read()}\n```")
from itables import show
show(support_matrix, ordering=False, paging=False, buttons=["copy", "excel", "csv"])
```
1 change: 1 addition & 0 deletions docs/theme-dark.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/*-- scss:defaults --*/
$code-color: #c2d94c;
$code-bg: #2b2b2b;
2 changes: 1 addition & 1 deletion gen_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main():
with Path(ibis.__file__).parents[1].joinpath(
"docs", "backends", "raw_support_matrix.csv"
).open(mode="w") as f:
df.to_csv(f, index_label="FullOperation")
df.to_csv(f, index_label="Operation")


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ sqlalchemy = ">=1.4,<3"
altair = { version = ">=5.0.1,<6", python = ">=3.10,<3.13" }
distributed = { version = ">=2022.9.1", python = ">=3.10,<3.13" }
ipykernel = { version = ">=6.25.1,<7", python = ">=3.10,<3.13" }
itables = { version = ">=1.6.3,<2", python = ">=3.10,<3.13" }
nbclient = { version = ">=0.8.0,<1", python = ">=3.10,<3.13" }
plotly = { version = ">=5.16.1,<6", python = ">=3.10,<3.13" }
plotnine = { version = ">=0.12.2,<1", python = ">=3.10,<3.13" }
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ipyleaflet==0.18.1 ; python_version >= "3.10" and python_version < "3.13"
ipython==8.18.1 ; python_version >= "3.9" and python_version < "4.0"
ipytree==0.2.2 ; python_version >= "3.10" and python_version < "3.13"
ipywidgets==8.1.1 ; python_version >= "3.10" and python_version < "3.13"
itables==1.6.3 ; python_version >= "3.10" and python_version < "3.13"
jaraco-classes==3.3.0 ; python_version >= "3.9" and python_version < "4.0"
jedi==0.19.1 ; python_version >= "3.9" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.9" and python_version < "4.0" and sys_platform == "linux"
Expand Down

0 comments on commit 21c92e5

Please sign in to comment.