Skip to content

Commit 9ebc7aa

Browse files
authored
✨ first rudementary API documentation (#9)
1 parent 8cc77c4 commit 9ebc7aa

File tree

6 files changed

+284
-2
lines changed

6 files changed

+284
-2
lines changed

.readthedocs.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.12"
13+
# apt_packages:
14+
# - some-package
15+
16+
# Build documentation in the "docs/" directory with Sphinx
17+
sphinx:
18+
configuration: docs/conf.py
19+
20+
# Optionally build your docs in additional formats such as PDF and ePub
21+
# formats:
22+
# - pdf
23+
# - epub
24+
25+
26+
# Optional but recommended, declare the Python requirements required
27+
# to build your documentation
28+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
29+
python:
30+
install:
31+
- method: pip
32+
path: .
33+
extra_requirements:
34+
- docs

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1-
# vcore
2-
Visualization library for omics data
1+
# Visualization Core (vuecore) library
2+
3+
Visualization library for omics data.
4+
5+
See also acore and vuegen.
6+
7+
## Installation
8+
9+
### Latest stable release from PyPI
10+
11+
```bash
12+
pip install vuecore
13+
```
14+
15+
### Latest development version from GitHub
16+
17+
Clone this repository and then install using pip the development version in
18+
editable mode:
19+
20+
```bash
21+
# git clone https://github.com/Multiomics-Analytics-Group/vuecore.git
22+
# cd vuecore
23+
pip install -e '.[dev]'
24+
```

docs/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# apidocs
2+
reference
3+
# builds
4+
_build
5+
jupyter_execute

docs/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Docs creation
2+
3+
In order to build the docs you need to
4+
5+
1. install sphinx and additional support packages
6+
2. build the package reference files
7+
3. run sphinx to create a local html version
8+
9+
The documentation is build using readthedocs automatically.
10+
11+
Install the docs dependencies of the package (as speciefied in toml):
12+
13+
```bash
14+
# in main folder
15+
# pip install ".[docs]"
16+
poetry install --with docs
17+
```
18+
19+
## Build docs using Sphinx command line tools
20+
21+
Command to be run from `path/to/docs`, i.e. from within the `docs` package folder:
22+
23+
Options:
24+
25+
- `--separate` to build separate pages for each (sub-)module
26+
27+
```bash
28+
# pwd: docs
29+
# apidoc
30+
sphinx-apidoc --force --implicit-namespaces --module-first -o reference ../src/vuecore
31+
# build docs
32+
sphinx-build -n -W --keep-going -b html ./ ./_build/
33+
```
34+
35+
## Include repo README.md into docs
36+
37+
Relative links are used in the main README, which need to be resolved when building. It's
38+
possible to include the a `relative-docs` option if one uses `index.md` ([see docs](https://myst-parser.readthedocs.io/en/latest/faq/index.html#include-a-file-from-outside-the-docs-folder-like-readme-md)). This does not work
39+
with `href` links, only native markdown links.

docs/conf.py

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
from importlib import metadata
15+
16+
# -- Project information -----------------------------------------------------
17+
18+
project = "vuecore"
19+
copyright = "2024, Multiomics-Analytics-Group"
20+
author = (
21+
"Multiomics-Analytics-Group, Sebastián Ayala Ruano, Henry Webel, Alberto Santos"
22+
)
23+
PACKAGE_VERSION = metadata.version("vuecore")
24+
version = PACKAGE_VERSION
25+
release = PACKAGE_VERSION
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.autodoc.typehints",
36+
"sphinx.ext.viewcode",
37+
"sphinx.ext.napoleon",
38+
"sphinx.ext.intersphinx",
39+
"sphinx_new_tab_link",
40+
"myst_nb",
41+
]
42+
43+
# https://myst-nb.readthedocs.io/en/latest/computation/execute.html
44+
nb_execution_mode = "auto"
45+
46+
myst_enable_extensions = ["dollarmath", "amsmath"]
47+
48+
# Plolty support through require javascript library
49+
# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly
50+
html_js_files = [
51+
"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"
52+
]
53+
54+
# https://myst-nb.readthedocs.io/en/latest/configuration.html
55+
# Execution
56+
nb_execution_raise_on_error = True
57+
# Rendering
58+
nb_merge_streams = True
59+
# maximum execution time per cell in seconds
60+
nb_execution_timeout = 120
61+
62+
# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
63+
# ! if you use it, then you cannot directly execute the notebook in the browser in colab
64+
# (the file needs to be fetched from the repository)
65+
# just keep both syncing it using papermill
66+
# nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}
67+
68+
# Add any paths that contain templates here, relative to this directory.
69+
templates_path = ["_templates"]
70+
71+
# List of patterns, relative to source directory, that match files and
72+
# directories to ignore when looking for source files.
73+
# This pattern also affects html_static_path and html_extra_path.
74+
exclude_patterns = [
75+
"_build",
76+
"Thumbs.db",
77+
".DS_Store",
78+
"jupyter_execute",
79+
"conf.py",
80+
]
81+
82+
83+
# Intersphinx options
84+
intersphinx_mapping = {
85+
"python": ("https://docs.python.org/3", None),
86+
"networkx": ("https://networkx.org/documentation/stable/", None),
87+
"pyvis": ("https://pyvis.readthedocs.io/en/stable/", None),
88+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
89+
# "scikit-learn": ("https://scikit-learn.org/stable/", None),
90+
"matplotlib": ("https://matplotlib.org/stable/", None),
91+
"numpy": ("https://numpy.org/doc/stable/", None),
92+
}
93+
94+
# -- Options for HTML output -------------------------------------------------
95+
96+
# The theme to use for HTML and HTML Help pages. See the documentation for
97+
# a list of builtin themes.
98+
# See:
99+
# https://github.com/executablebooks/MyST-NB/blob/master/docs/conf.py
100+
# html_title = ""
101+
html_theme = "sphinx_book_theme"
102+
# html_logo = "_static/logo-wide.svg"
103+
# html_favicon = "_static/logo-square.svg"
104+
html_theme_options = {
105+
"github_url": "https://github.com/Multiomics-Analytics-Group/vuecore",
106+
"repository_url": "https://github.com/Multiomics-Analytics-Group/vuecore",
107+
"repository_branch": "main",
108+
"home_page_in_toc": True,
109+
"path_to_docs": "docs",
110+
"show_navbar_depth": 1,
111+
"use_edit_page_button": True,
112+
"use_repository_button": True,
113+
"use_download_button": True,
114+
"launch_buttons": {
115+
"colab_url": "https://colab.research.google.com"
116+
# "binderhub_url": "https://mybinder.org",
117+
# "notebook_interface": "jupyterlab",
118+
},
119+
"navigation_with_keys": False,
120+
}
121+
122+
# Add any paths that contain custom static files (such as style sheets) here,
123+
# relative to this directory. They are copied after the builtin static files,
124+
# so a file named "default.css" will overwrite the builtin "default.css".
125+
# html_static_path = ["_static"]
126+
127+
128+
# -- Setup for sphinx-apidoc -------------------------------------------------
129+
130+
# Read the Docs doesn't support running arbitrary commands like tox.
131+
# sphinx-apidoc needs to be called manually if Sphinx is running there.
132+
# https://github.com/readthedocs/readthedocs.org/issues/1139
133+
134+
if os.environ.get("READTHEDOCS") == "True":
135+
from pathlib import Path
136+
137+
PROJECT_ROOT = Path(__file__).parent.parent
138+
PACKAGE_ROOT = PROJECT_ROOT / "src" / "vuecore"
139+
140+
def run_apidoc(_):
141+
from sphinx.ext import apidoc
142+
143+
apidoc.main(
144+
[
145+
"--force",
146+
"--implicit-namespaces",
147+
"--module-first",
148+
"--separate",
149+
"-o",
150+
str(PROJECT_ROOT / "docs" / "reference"),
151+
str(PACKAGE_ROOT),
152+
str(PACKAGE_ROOT / "*.c"),
153+
str(PACKAGE_ROOT / "*.so"),
154+
]
155+
)
156+
157+
def setup(app):
158+
app.connect("builder-inited", run_apidoc)

docs/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- https://myst-parser.readthedocs.io/en/latest/faq/index.html
2+
#include-a-file-from-outside-the-docs-folder-like-readme-md -->
3+
4+
```{include} ../README.md
5+
:start-line: 0
6+
:relative-docs: docs
7+
:relative-images:
8+
```
9+
10+
```{toctree}
11+
:maxdepth: 2
12+
:caption: Modules
13+
:hidden:
14+
15+
reference/vuecore
16+
```
17+
18+
```{toctree}
19+
:maxdepth: 1
20+
:caption: MISC:
21+
:hidden:
22+
23+
README.md
24+
```

0 commit comments

Comments
 (0)