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

Setting up infrastructure for documentation and jupyterlite #82

Merged
merged 48 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c12b2f
First try at creating docs
hoxbro Dec 1, 2023
5b59e46
Run build
hoxbro Dec 1, 2023
8aa3bd3
Move examples into subfolders
hoxbro Dec 1, 2023
d449426
Update index.md
hoxbro Dec 1, 2023
0932664
Add custom css
hoxbro Dec 1, 2023
e7d7365
Add github stars
hoxbro Dec 1, 2023
79698c7
Fix wrong name
hoxbro Dec 1, 2023
90c9e0e
Add jupyterlite
hoxbro Dec 5, 2023
8f4d02a
Add patch_lock
hoxbro Dec 5, 2023
a647bc3
Add matplotlib to docs dependencies
hoxbro Dec 5, 2023
1040ffb
Update gitignore with .rst and .ipynb
hoxbro Dec 5, 2023
01ff784
Update server command
hoxbro Dec 5, 2023
5c82d45
Apply suggestions from code review
hoxbro Dec 5, 2023
f9aa052
Add reference_manual
hoxbro Dec 5, 2023
2751d8b
Add docs:server
hoxbro Dec 6, 2023
f6033ae
Move demo gif to doc folder
hoxbro Dec 6, 2023
a2d76e8
Add custom jupyterlite sqliteconnection
hoxbro Dec 6, 2023
9450f24
Start tutorial
hoxbro Dec 6, 2023
39a0a4b
Add first annotation
hoxbro Dec 6, 2023
240b801
Add multiple examples
hoxbro Dec 6, 2023
4eba1bb
misc changes
hoxbro Dec 6, 2023
d2c5f2b
Add to tutotorial to docs
hoxbro Dec 6, 2023
612594b
Update demo.gif
hoxbro Dec 6, 2023
7cb3afe
Fix folder misspelling
hoxbro Dec 6, 2023
696d652
Update docs env and comment out not created tutorials
hoxbro Dec 6, 2023
c5109aa
Add scipy to dev
hoxbro Dec 6, 2023
8e810a3
Use jupyterlab-myst and create examples as optional dependencies
hoxbro Dec 7, 2023
92a1d9a
Add edit annotation and delete annotation to first annotation
hoxbro Dec 7, 2023
2cefa9e
Update text
hoxbro Dec 7, 2023
baec3e9
misc updates
hoxbro Dec 7, 2023
9644db1
Remove empty ending lines
hoxbro Dec 7, 2023
2c1affa
Fix filename
hoxbro Dec 7, 2023
e83ee98
Add styling of annotation notebook
hoxbro Dec 7, 2023
ae87bf4
Remove github_stars.html
hoxbro Dec 7, 2023
c7f47dd
Add make an app tutorial
hoxbro Dec 7, 2023
7e85b00
Update reference_manual.md
hoxbro Dec 7, 2023
c57e895
Remove noqa
hoxbro Dec 7, 2023
622ee11
Merge branch 'main' into docs
hoxbro Dec 7, 2023
35b6aac
Merge branch 'main' into docs
hoxbro Dec 7, 2023
83c1c96
Add quote around python version
hoxbro Dec 7, 2023
c59616e
Use local holonote wheel
hoxbro Dec 7, 2023
873bdb7
Move fastparquet to pandas
hoxbro Dec 7, 2023
3b14891
Move fastparquet to hvplot
hoxbro Dec 7, 2023
f11e13c
Misc fixes
hoxbro Dec 8, 2023
000fedc
Add pyparsing to holoviews
hoxbro Dec 8, 2023
16f10f2
Add jupyterlite icon
hoxbro Dec 11, 2023
640234c
Update link
hoxbro Dec 11, 2023
968e255
Correctly link to tutorial notebooks
hoxbro Dec 11, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- cron: '0 13 * * SUN'

env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.9"

jobs:
build_docs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jupyterlite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- cron: '0 19 * * SUN'

env:
PYTHON_VERSION: 3.10
PYTHON_VERSION: "3.10"
NODE_VERSION: "18"

jobs:
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@ dist
scratch
holonote/_version.py
annotations.db

# docs
builtdocs
jupyter_execute
doc/**/*.rst
doc/**/*.ipynb

# jupyterlite
jupyterlite/
!scripts/jupyterlite
scripts/jupyterlite/.jupyterlite.doit.db
scripts/jupyterlite/*.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The `holonote` library offers tools to create, edit and persist
annotated regions for [HoloViews](https://holoviews.org/).

![Annotation demo](https://github.com/holoviz/holonote/blob/main/examples/assets/demo.gif)
![Annotation demo](https://assets.holoviz.org/holonote/demo.gif)

An annotated region marks a region-of-interest that is overlaid on top
of the visual representation of a HoloViews element. Such a region has a
Expand Down
Empty file added doc/_static/assets/.empty
Empty file.
1 change: 1 addition & 0 deletions doc/_static/assets/jupyterlite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions doc/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
:root[data-theme='light'],
:root[data-theme='dark'] {
--pst-color-primary: rgb(47,47,47);
--pst-color-link: rgb(163,26,38);
--pst-color-link-hover: rgb(254,203,56);
--pst-color-surface: rgb(250, 250, 250);
}

/* Fix breadcrumb overlap https://github.com/holoviz/panel/issues/5199 */
.header-article__inner .header-article-item {
height: unset;
}

/* Homepage Showcase */

.showcase-table {
border-spacing: 15px;
}

.showcase-table td {
border: 0px;
vertical-align: top;
}

/* Homepage sponsors */

.sd-card-body.sponsor-logo {
flex-grow: unset;
margin: auto;
}

.sponsor-logo img {
min-height: 80px;
object-fit: contain;
}

/* Tweaks for code cell rendering */

.highlight {
border-radius: 4px;
}

html[data-theme='light'] .highlight {
background-color: #263238;
color: #f8f8f2;
}

pre[id^='codecell'] {
background-color: unset;
border: none;
border-radius: 0.5em;
color: #f8f8f2;
box-shadow: none;
padding: 1.5em;
}

div.highlight button.copybtn.o-tooltip--left:after {
background-color: #263235;
border: 1px solid gray;
border-radius: 4px;
padding: 5px;
}

button.copybtn {
background-color: #263238;
}

button.copybtn:hover {
background-color: #263238;
color: #f8f8f2;
}

.highlight button.copybtn:hover {
background: none;
}

.o-tooltip--left:after {
background: none;
}
8 changes: 8 additions & 0 deletions doc/_templates/jupyterlitelink.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{# Custom template to include a link to Panelite #}
<div class="tocsection">
{% if title and pagename != root_doc and (pagename.startswith("tutorial") or pagename.startswith("basics")) %}
<a href="{{ jupyterlite_endpoint + '/lab' + ('' if pagename.endswith('index') else '?path=' + pagename + '.ipynb') }}" target=”_blank”>
<img src="{{ pathto('_static/assets/jupyterlite.svg', 1) }}" alt="launch jupyterlite"></img>
</a>
{% endif %}
</div>
14 changes: 14 additions & 0 deletions doc/basics/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Basics

Will give a short introduction to the basics of holonote.

```{toctree}
:titlesonly:
:hidden:
:maxdepth: 1

Basics
Basics_2D
MultiPlot
styling
```
146 changes: 146 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import os
from pathlib import Path

import param
from nbsite.shared_conf import * # noqa: F403

import holonote as hn

param.parameterized.docstring_signature = False
param.parameterized.docstring_describe_params = False


project = "HoloNote"
authors = "HoloNote contributors"
copyright_years["start_year"] = "2023"
copyright = copyright_fmt.format(**copyright_years)
description = "Tools to create, edit and persist annotated regions for HoloViews"
version = release = base_version(hn.__version__)
is_dev = any(ext in version for ext in ("a", "b", "rc"))

HOLONOTE_ROOT = Path(hn.__file__).parents[1]
# Remove database files if they exist
for db in (HOLONOTE_ROOT / "examples").rglob("*.db"):
db.unlink()


# For the interactivity warning box created by nbsite to point to the right
# git tag instead of the default i.e. main.
os.environ["BRANCH"] = f"v{release}"

html_static_path += ["_static"]

html_css_files += ["css/custom.css"]

html_theme = "pydata_sphinx_theme"
# html_favicon = "_static/icons/favicon.ico"

html_theme_options = {
# "logo": {
# "image_light": "_static/logo_horizontal_light_theme.png",
# "image_dark": "_static/logo_horizontal_dark_theme.png",
# },
"github_url": "https://github.com/holoviz/holonote",
"icon_links": [
{
"name": "Discourse",
"url": "https://discourse.holoviz.org/",
"icon": "fa-brands fa-discourse",
},
{
"name": "Discord",
"url": "https://discord.gg/UXdtYyGVQX",
"icon": "fa-brands fa-discord",
},
],
"pygment_light_style": "material",
"pygment_dark_style": "material",
"header_links_before_dropdown": 5,
"secondary_sidebar_items": [
"github-stars-button",
"jupyterlitelink",
"page-toc",
],
}

extensions += ["sphinx.ext.napoleon", "nbsite.gallery"]
napoleon_numpy_docstring = True

myst_enable_extensions = ["colon_fence", "deflist"]

jupyterlite_url = "https://holoviz-dev.github.io/holonote-jupyterlite"

nbsite_gallery_conf = {
"github_org": "holoviz",
"github_project": "holonote",
"jupyterlite_url": jupyterlite_url,
"galleries": {},
}

templates_path += ["_templates"]

html_context.update(
{
"last_release": f"v{release}",
"github_user": "holoviz",
"github_repo": "holonote",
"default_mode": "light",
"jupyterlite_endpoint": jupyterlite_url,
}
)

nbbuild_patterns_to_take_along = ["simple.html", "*.json", "json_*"]

# Override the Sphinx default title that appends `documentation`
html_title = f"{project} v{version}"


# Patching GridItemCardDirective to be able to substitute the domain name
# in the link option.
# from sphinx_design.cards import CardDirective
# from sphinx_design.grids import GridItemCardDirective

# orig_grid_run = GridItemCardDirective.run


# def patched_grid_run(self):
# app = self.state.document.settings.env.app
# existing_link = self.options.get("link")
# domain = getattr(app.config, "grid_item_link_domain", None)
# if self.has_content:
# self.content.replace("|gallery-endpoint|", domain)
# if existing_link and domain:
# new_link = existing_link.replace("|gallery-endpoint|", domain)
# self.options["link"] = new_link
# return list(orig_grid_run(self))


# GridItemCardDirective.run = patched_grid_run

# orig_card_run = CardDirective.run


# def patched_card_run(self):
# app = self.state.document.settings.env.app
# existing_link = self.options.get("link")
# domain = getattr(app.config, "grid_item_link_domain", None)
# if existing_link and domain:
# new_link = existing_link.replace("|gallery-endpoint|", domain)
# self.options["link"] = new_link
# return orig_card_run(self)


# CardDirective.run = patched_card_run


def setup(app) -> None:
try:
from nbsite.paramdoc import param_formatter, param_skip

app.connect("autodoc-process-docstring", param_formatter)
app.connect("autodoc-skip-member", param_skip)
except ImportError:
print("no param_formatter (no param?)")

nbbuild.setup(app)
app.add_config_value("grid_item_link_domain", "", "html")
Loading