Skip to content

Commit

Permalink
Ran Prettier on the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Jan 10, 2024
1 parent f2b61f7 commit 5177c40
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/adamchainz/blacken-docs
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.15.0
hooks:
- id: blacken-docs
- id: blacken-docs
additional_dependencies:
- black==22.12.0
- repo: https://github.com/psf/black
- black==22.12.0
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- id: black
110 changes: 109 additions & 1 deletion docker/data/storage/layouts/demo-layout.json
Original file line number Diff line number Diff line change
@@ -1 +1,109 @@
{"filterSets":[],"layoutConfig":[{"type":"row","height":100,"isClosable":true,"isFocusOnShow":true,"reorderEnabled":true,"title":"","content":[{"type":"stack","isClosable":true,"isFocusOnShow":true,"reorderEnabled":true,"title":"","width":47.87172011661808,"activeItemIndex":0,"content":[{"type":"react-component","component":"ConsolePanel","title":"Console","isClosable":false,"id":"EwmgpXQqE","props":{"metadata":{},"panelState":{"consoleSettings":{},"itemIds":[]}},"componentName":"lm-react-component","isFocusOnShow":true,"reorderEnabled":true,"componentState":null},{"type":"react-component","component":"LogPanel","title":"Log","isClosable":false,"id":"l9Ll30LIS8","props":{"metadata":{}},"componentName":"lm-react-component","isFocusOnShow":true,"reorderEnabled":true,"componentState":null}]},{"type":"stack","width":52.12827988338192,"isClosable":true,"isFocusOnShow":true,"reorderEnabled":true,"title":"","activeItemIndex":2,"content":[{"type":"react-component","component":"CommandHistoryPanel","title":"Command History","isClosable":false,"id":"qfsNtUkwNG","props":{"metadata":{},"panelState":{}},"componentName":"lm-react-component","isFocusOnShow":true,"reorderEnabled":true,"componentState":null},{"type":"react-component","component":"FileExplorerPanel","title":"File Explorer","isClosable":false,"id":"x0ISsm_Crj","props":{"metadata":{}},"componentName":"lm-react-component","isFocusOnShow":true,"reorderEnabled":true,"componentState":null},{"type":"react-component","component":"NotebookPanel","isFocusOnShow":false,"props":{"metadata":{"id":"KfJJtrr0G"},"panelState":{"settings":{"language":""},"fileMetadata":{"id":"/DEMO.md","itemName":"/DEMO.md"},"isPreview":true}},"title":"DEMO.md","id":"KfJJtrr0G","componentName":"lm-react-component","isClosable":true,"reorderEnabled":true,"componentState":null}]}]}],"links":[],"version":2}
{
"filterSets": [],
"layoutConfig": [
{
"type": "row",
"height": 100,
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"content": [
{
"type": "stack",
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"width": 47.87172011661808,
"activeItemIndex": 0,
"content": [
{
"type": "react-component",
"component": "ConsolePanel",
"title": "Console",
"isClosable": false,
"id": "EwmgpXQqE",
"props": {
"metadata": {},
"panelState": { "consoleSettings": {}, "itemIds": [] }
},
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "LogPanel",
"title": "Log",
"isClosable": false,
"id": "l9Ll30LIS8",
"props": { "metadata": {} },
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
}
]
},
{
"type": "stack",
"width": 52.12827988338192,
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"activeItemIndex": 2,
"content": [
{
"type": "react-component",
"component": "CommandHistoryPanel",
"title": "Command History",
"isClosable": false,
"id": "qfsNtUkwNG",
"props": { "metadata": {}, "panelState": {} },
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "FileExplorerPanel",
"title": "File Explorer",
"isClosable": false,
"id": "x0ISsm_Crj",
"props": { "metadata": {} },
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "NotebookPanel",
"isFocusOnShow": false,
"props": {
"metadata": { "id": "KfJJtrr0G" },
"panelState": {
"settings": { "language": "" },
"fileMetadata": { "id": "/DEMO.md", "itemName": "/DEMO.md" },
"isPreview": true
}
},
"title": "DEMO.md",
"id": "KfJJtrr0G",
"componentName": "lm-react-component",
"isClosable": true,
"reorderEnabled": true,
"componentState": null
}
]
}
]
}
],
"links": [],
"version": 2
}
18 changes: 15 additions & 3 deletions plugins/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"plugins": [
{ "name": "matplotlib", "version": "0.1.0", "main": "src/js/dist/index.js" },
{ "name": "plotly-express", "version": "0.1.0", "main": "src/js/dist/bundle/index.js" },
{ "name": "auth-keycloak", "version": "0.1.0", "main": "src/js/dist/index.js" },
{
"name": "matplotlib",
"version": "0.1.0",
"main": "src/js/dist/index.js"
},
{
"name": "plotly-express",
"version": "0.1.0",
"main": "src/js/dist/bundle/index.js"
},
{
"name": "auth-keycloak",
"version": "0.1.0",
"main": "src/js/dist/index.js"
},
{ "name": "ui", "version": "0.1.0", "main": "src/js/dist/index.js" }
]
}
11 changes: 9 additions & 2 deletions plugins/matplotlib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

The Deephaven Plugin for matplotlib. Allows for opening matplotlib plots in a Deephaven environment. Any matplotlib plot
should be viewable by default. For example:

```python
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.subplots() # Create a figure containing a single axes.
ax.plot([1, 2, 3, 4], [4, 2, 6, 7]) # Plot some data on the axes.
```

You can also use `TableAnimation`, which allows updating a plot whenever a Deephaven Table is updated.

## `TableAnimation` Usage
Expand All @@ -17,6 +19,7 @@ You can also use `TableAnimation`, which allows updating a plot whenever a Deeph
is being listened to updates, the provided function will run again.

### Line Plot

```python
import matplotlib.pyplot as plt
from deephaven import time_table
Expand Down Expand Up @@ -45,7 +48,9 @@ ani = TableAnimation(fig, tt, update_fig)
```

### Scatter Plot

Scatter plots require data in a different format that Line plots, so need to pass in the data differently.

```python
import matplotlib.pyplot as plt
from deephaven import time_table
Expand Down Expand Up @@ -82,7 +87,9 @@ ani = TableAnimation(fig, tt, update_fig)
```

### Multiple Series

It's possible to have multiple kinds of series in the same figure. Here is an example driving a line and a scatter plot:

```python
import matplotlib.pyplot as plt
from deephaven import time_table
Expand Down Expand Up @@ -134,7 +141,7 @@ To build:
python -m build --wheel
```

The wheel is stored in `dist/`.
The wheel is stored in `dist/`.

To test within [deephaven-core](https://github.com/deephaven/deephaven-core), note where this wheel is stored (using `pwd`, for example).
Then, follow the directions in the top-level README.md to install the wheel into your Deephaven environment.
Then, follow the directions in the top-level README.md to install the wheel into your Deephaven environment.
8 changes: 6 additions & 2 deletions plugins/plotly-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,27 @@ To build:
python -m build --wheel
```

The wheel is stored in `dist/`.
The wheel is stored in `dist/`.

To test within [deephaven-core](https://github.com/deephaven/deephaven-core), note where this wheel is stored (using `pwd`, for example).
Then, follow the directions in the top-level README.md to install the wheel into your Deephaven environment.

To unit test, run the following command from the root of the repo:

```sh
tox -e py
```

## Usage

Once you have the plugin installed and the server started, the recommended way to import the package mirrors plotly express:

```python
import deephaven.plot.express as dx
```

Then, you can create a table (or use an existing one) and start plotting

```python
from deephaven.column import int_col, string_col
import deephaven.plot.express as dx
Expand All @@ -49,4 +53,4 @@ source = new_table(
)

fig = dx.bar(table=source, x="Categories", y="Values")
```
```
8 changes: 6 additions & 2 deletions plugins/plotly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The Deephaven Plugin for Plotly. Allows for opening Plotly plots in a Deephaven
should be viewable by default. For example:

### Scatter Plot

```python
import plotly.express as px

Expand All @@ -19,6 +20,7 @@ fig = px.scatter(
```

### Box Plot

```python
import plotly.express as px

Expand All @@ -27,7 +29,9 @@ fig = px.box(df, x="time", y="total_bill")
```

### Multiple Series

It's possible to have multiple kinds of series in the same figure. Here is an example driving a line and a bar plot:

```python
from plotly.subplots import make_subplots
import plotly.graph_objects as go
Expand All @@ -45,6 +49,7 @@ fig.update_layout(title_text="Side By Side Subplots", showlegend=False)
```

### Plot data from a Deephaven table

```python
from deephaven import empty_table, numpy
import plotly.express as px
Expand All @@ -71,8 +76,7 @@ To build:
python -m build --wheel
```

The wheel is stored in `dist/`.
The wheel is stored in `dist/`.

To test within [deephaven-core](https://github.com/deephaven/deephaven-core), note where this wheel is stored (using `pwd`, for example).
Then, follow the directions in the top-level README.md to install the wheel into your Deephaven environment.

14 changes: 7 additions & 7 deletions plugins/ui/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ ui_table.selection_mode(mode: SelectionMode) -> UITable
##### sort

Provide the default sort that will be used by the UI.
Can use Deephaven [SortDirection](https://deephaven.io/core/pydoc/code/deephaven.html#deephaven.SortDirection) used in
Can use Deephaven [SortDirection](https://deephaven.io/core/pydoc/code/deephaven.html#deephaven.SortDirection) used in
a table [sort](https://deephaven.io/core/docs/reference/table-operations/sort/) operation or`"ASC"` or `"DESC"`.

###### Syntax
Expand All @@ -1403,7 +1403,7 @@ ui_table.sort(
###### Parameters

| Parameter | Type | Description |
| ----------- |--------------------------------------------------------------| ----------------------------------------------------------------------------------------------------------- |
| ----------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| `by` | `str \| Sequence[str]` | The column(s) to sort by. May be a single column name, or a list of column names. |
| `direction` | `TableSortDirection \| Sequence[TableSortDirection] \| None` | The sort direction(s) to use. If provided, that must match up with the columns provided. Defaults to "ASC". |

Expand Down Expand Up @@ -1480,11 +1480,11 @@ use_table_data(

###### Parameters

| Parameter | Type | Description |
|--------------------|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `table` | `Table` | The table to retrieve data from. |
| `sentinel` | `Sentinel` | A sentinel value to return if the viewport is still loading. Default `None`. |
| `transform` | `Callable[[pd.DataFrame \| Sentinel, bool], TransformedData \| Sentinel]` | A function to transform the data from a pandas Dataframe to a custom object. The function takes a pandas dataframe or `Sentinel` as the first value and as a second value `bool` that is `True` if the the first value is the sentinel. |
| Parameter | Type | Description |
| ----------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `table` | `Table` | The table to retrieve data from. |
| `sentinel` | `Sentinel` | A sentinel value to return if the viewport is still loading. Default `None`. |
| `transform` | `Callable[[pd.DataFrame \| Sentinel, bool], TransformedData \| Sentinel]` | A function to transform the data from a pandas Dataframe to a custom object. The function takes a pandas dataframe or `Sentinel` as the first value and as a second value `bool` that is `True` if the the first value is the sentinel. |

##### use_column_data

Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ tt = table_tabs(stocks)
## Using Table Data Hooks

There are five different hooks that can be used to get data from a table:
1. `use_table_data`: Returns a dictionary of rows and columns from the table.

1. `use_table_data`: Returns a dictionary of rows and columns from the table.
2. `use_row_data`: Returns a single row from the table as a dictionary
3. `use_row_list`: Returns a single row from the table as a list
4. `use_column_data`: Returns a single column from the table as a list
Expand Down Expand Up @@ -812,4 +813,3 @@ watch = watch_lizards(stocks)
```

![Table Hooks](assets/table_hooks.png)

0 comments on commit 5177c40

Please sign in to comment.