Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: function autodocs embedded in docs #527

Merged
merged 12 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/plotly-express/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist/
*.egg-info/
.idea
.DS_store
__pycache__/
__pycache__/
/docs/build/
20 changes: 20 additions & 0 deletions plugins/plotly-express/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -c .
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docs
BUILDDIR = docs/build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
16 changes: 16 additions & 0 deletions plugins/plotly-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,19 @@ source = new_table(

fig = dx.bar(table=source, x="Categories", y="Values")
```

## Docs
Docs can be built locally

Install the necessary dependencies:
```shell
pip install -r requirements.txt
pip install dist/deephaven_plugin_plotly_express-*.whl
```
then run the docs make script:
```shell
python make_docs.py
```

The files will be built into `docs/build/markdown`.
Note that these built files should not be committed to the repository.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do the built files get outputted? Should include that info here.

I'm getting an error right now when building locally:

Building markdown
Running Sphinx v7.2.6
1 compiler directives added
# Starting io.deephaven.python.server.EmbeddedServer
deephaven.cacheDir=/home/bender/.cache/deephaven
deephaven.configDir=/home/bender/.config/deephaven
deephaven.dataDir=/home/bender/.local/share/deephaven
# io.deephaven.internal.log.LoggerFactoryServiceLoaderImpl: searching for 'io.deephaven.internal.log.LoggerFactory'...
# io.deephaven.internal.log.LoggerFactoryServiceLoaderImpl: found 'io.deephaven.internal.log.LoggerFactorySlf4j'
Server started on port 10075

Extension error:
Could not import extension sphinx_autodoc_typehints (exception: No module named 'sphinx_autodoc_typehints')
make: *** [Makefile:20: markdown] Error 2
Copying assets
cp: cannot create directory 'docs/build/markdown/_assets': No such file or directory
cp: cannot create regular file 'docs/build/markdown/sidebar.json': No such file or directory
rm: cannot remove 'docs/build/markdown/index.md': No such file or directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why... double checked and works for me. Are you using 3.8? Looks like sphinx_autodoc_typehints will require 3.9. Should be fine since we only need it for building the docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I just tried again and all good. For ref I'm on python 3.10.12

42 changes: 42 additions & 0 deletions plugins/plotly-express/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "deephaven"
copyright = "2024, Deephaven Data Labs"
author = "Deephaven Data Labs"
release = "0.7.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_markdown_builder",
"sphinx_autodoc_typehints",
]

source_suffix = [".rst", ".md"] # Can use either rst or markdown files as input

# show hints in the description so that the function definition is not cluttered
autodoc_typehints = "description"

# exclude build directory
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]

# options for sphinx_autodoc_typehints
always_use_bars_union = True
typehints_defaults = "comma"

from deephaven_server import Server

s = Server(port=10075)
s.start()
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/area.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ Area plots are useful for:
4. **Time Series Analysis**: For time-dependent data, area plots are valuable for displaying changes in categorical contributions and overall trends over time.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.area
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ Advantages of bar plots include:
Bar plots have limitations and are not suitable for certain scenarios. They are not ideal for continuous data, ineffective for multi-dimensional data exceeding two dimensions, and unsuitable for time-series data trends. Additionally, they become less practical with extremely sparse datasets and are inadequate for representing complex interactions or correlations among multiple variables.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.bar
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ Box plots are useful for:
4. **Robustness**: Box plots are robust to extreme values and data skewness, providing a reliable means of visualizing data distributions even in the presence of outliers or non-normal data.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.box
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/candlestick.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ Candlestick plots are useful for:
4. **Visualizing Variation in Price Data**: Candlestick charts offer a visually intuitive way to represent variability in price data, making them valuable for traders and analysts who prefer a visual approach to data analysis.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.candlestick
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/funnel-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ Funnel area plots are useful for:
4. **Data Funneling**: When representing data where values funnel through stages or categories.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.funnel_area
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/funnel.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ Funnel plots are useful for:
2. **Sequential Processes**: Funnel plots are suitable for visualizing data within sequential processes, where data typically funnels through various stages.
3. **Data Distribution**: When you want to gain insights into the distribution of data at each stage within a process, and you can represent multiple categories as stacked bars for comparative analysis.
4. **Efficiency Assessment**: To assess the efficiency and effectiveness of a process, particularly when evaluating the attrition or conversion of elements at each stage.


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.funnel
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ Histogram plots are useful for:
4. **Density Estimation**: Histograms can serve as the basis for density estimation methods, helping to model and understand underlying data distributions, which is crucial in statistical analysis and machine learning.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.histogram
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/icicle.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ Icicle plots are useful for:
4. **Comparative Analysis**: The consistent and proportional layout of icicle charts makes them effective for comparing the size and structure of different branches within the hierarchy. Users can easily identify and compare the relative importance or size of various categories, facilitating better decision-making and resource allocation.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.icicle
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats this file for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx complains if documents are not in a toctree for some reason

.. toctree::
:maxdepth: 2
:glob:

*
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/layer-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
To "layer" or "stack" multiple plots on top of each other, use the `layer` function. This is useful if you want to combine multiple plots of different types into a single plot, such as a scatter plot and a line plot. By default, last plot given will be used for the layout. The `which_layout` parameter can be used to specify which plot's layout should be used. The `specs` parameter can be used to specify the domains of each plot.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.layer
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/line-3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Alternatives to 3D line plots include:

- **Scatter Plots with Color or Size Mapping**: These can be used to represent three variables with the addition of color or size mapping to signify the third dimension.
- **Surface Plots**: When visualizing continuous data over a 3D space, surface plots may be more appropriate, as they create a continuous surface representation.


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.line_3d
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/line-polar.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ Polar line plots are useful for:
4. **Circular Data Exploration**: They can be used to explore and analyze data where the angular or periodic nature of the data is a significant aspect, making them useful in fields like meteorology, geophysics, and biology.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.line_polar
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/line-ternary.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ Ternary line plots are useful for:
1. **Compositional Data Representation**: Ternary line plots are suitable for representing compositional data where the total proportion remains constant, allowing for the visualization of how components change relative to one another.
2. **Multivariate Data Analysis**: They are useful in multivariate data analysis to visualize relationships and trends among three variables or components that are interrelated.
3. **Optimization Studies**: Ternary line plots can be applied in optimization studies to understand how adjustments in the proportions of three components impact the overall composition, aiding in informed decision-making.


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.line_ternary
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/line.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,8 @@ scatter_plot_opacity = dx.scatter(
opacity=0.5
)
```

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.line
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/ohlc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ OHLC (Open-High-Low-Close) plots are useful for:
3. **Quantitative Analysis**: OHLC data can be leveraged for quantitative analysis, statistical modeling, and the development of trading strategies, making them valuable in algorithmic and systematic trading.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.ohlc
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/pie.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ Limitations of pie plots include:
2. **Comparison Complexity**: Comparing the sizes of slices in a pie plot is less precise than with other chart types, such as bar plots or stacked bar charts. This makes it less suitable for situations where accurate quantitative comparisons are crucial.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.pie
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/scatter-3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,8 @@ scatter_plot_color_column = dx.scatter_3d(
color_discrete_map="identity"
)
```

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.scatter_3d
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/scatter-polar.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Polar scatter plots are useful for:
3. **Angular or Periodic Data Relationships**: Polar scatter plots aid in exploring relationships and correlations in data with angular or periodic dependencies, making them suitable for applications where understanding circular patterns is essential.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.scatter_polar
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/scatter-ternary.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Ternary scatter plots are useful for:
3. **Optimization Studies**: Ternary scatter plots aid in optimization studies to understand how adjustments in the proportions of three components impact the overall composition, making them valuable in informed decision-making processes.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.scatter_ternary
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/scatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,8 @@ scatter_plot_opacity = dx.scatter(
opacity=0.5
)
```

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.scatter
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/strip.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ Strip plots are useful for:
4. **Comparing Data Categories**: Comparing the distribution and spread of data across different categories or groups, making it useful for categorical data analysis.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.strip
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/sub-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
Multiple sub plots can be combined into one plot using the `make_subplots` function. This function accepts multiple plot objects, and returns a single plot object. The plot objects can be any of the plot types supported by Deephaven Express. They can be arranged in a grid, or in a single row or column. The `shared_xaxes` and `shared_yaxes` parameters can be used to share axes between plots.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.make_subplots
```
5 changes: 5 additions & 0 deletions plugins/plotly-express/docs/sunburst.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ Sunburst plots are useful for:
3. **Drill-Down Data Exploration**: Developers can implement sunburst plots for drill-down data exploration, allowing users to interactively explore and delve deeper into hierarchical data by clicking on sectors to reveal lower-level categories or information. This use case is valuable in applications that require detailed hierarchical data analysis.

## Examples

## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.sunburst
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
Timeline plots in offer a means to visualize time-related data, displaying events, durations, or activities along a time axis. Developers can utilize these plots for applications that require users to understand temporal patterns and relationships, such as project management, event scheduling, and historical data analysis.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.timeline
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/treemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Treemap plots are useful for:
3. **Data Summarization**: Treemaps are effective for summarizing large amounts of hierarchical data into a compact, visual format. Developers can use treemaps to provide users with an overview of hierarchical data, and users can drill down into specific categories for more detailed information.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.treemap
```
6 changes: 6 additions & 0 deletions plugins/plotly-express/docs/violin.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ Violin plots are useful for:
4. **Multimodal Data**: They are particularly useful when dealing with data that exhibits multiple modes or peaks, as they can reveal these underlying patterns effectively.

## Examples


## API Reference
```{eval-rst}
.. autofunction:: deephaven.plot.express.violin
```
35 changes: 35 additions & 0 deletions plugins/plotly-express/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=docs
set BUILDDIR=docs/build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Loading
Loading