Skip to content

Commit 42fb51c

Browse files
authored
Add documentation with Jupyterlite demo (#8)
* Add a first documentation * prettier * Add nodejs dependency for rtd installation * Typo * update documentation and jupyterlite-sphinx directive options * Update jupyterlite-sphinx * use mamba for readthedoc installation, to be able to use xeus-python-kernel * Fix environment file * Remove sphinx makefile, and adds hatch script for docs * Update jupyterlite-sphinx dependency
1 parent d654a6e commit 42fb51c

File tree

6 files changed

+108
-1
lines changed

6 files changed

+108
-1
lines changed

.readthedocs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "mambaforge-4.10"
7+
nodejs: "18"
8+
9+
sphinx:
10+
builder: html
11+
configuration: docs/conf.py
12+
13+
conda:
14+
environment: docs-environment.yml

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# litegitpuller
22

3-
[![Github Actions Status](https://github.com/jupyterlite/litegitpuller/workflows/Build/badge.svg)](https://github.com/jupyterlite/litegitpuller/actions/workflows/build.yml)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlite/litegitpuller/main?urlpath=lab)
3+
[![Github Actions Status](https://github.com/jupyterlite/litegitpuller/workflows/Build/badge.svg)](https://github.com/jupyterlite/litegitpuller/actions/workflows/build.yml)
4+
45
A jupyterlite extension to automate cloning of a github repository.
56

7+
## Docs
8+
9+
https://litegitpuller.readthedocs.io/en/latest/index.html
10+
611
## Requirements
712

813
- JupyterLab >= 3.0

docs-environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: litegitpuller-docs
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pip
6+
- jupyterlite-xeus-python >=0.9.0,<0.10.0
7+
- pip:
8+
- .[docs]

docs/conf.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
3+
project = 'litegitpuller'
4+
copyright = '2023, Jupyter Development Team'
5+
author = 'Jupyter Development Team'
6+
7+
# -- General configuration ---------------------------------------------------
8+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
9+
10+
extensions = [
11+
'jupyterlite_sphinx',
12+
'myst_parser',
13+
]
14+
15+
templates_path = ['_templates']
16+
exclude_patterns = []
17+
18+
19+
# -- Options for HTML output -------------------------------------------------
20+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
21+
22+
html_theme = 'pydata_sphinx_theme'
23+
html_static_path = ['_static']
24+
25+
jupyterlite_bind_ipynb_suffix = False

docs/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# litegitpuller
2+
3+
A Jupyterlab/jupyterlite extension to fetch github repositories.
4+
5+
As for [nbgitpuller](https://github.com/jupyterhub/nbgitpuller), information about the repository to fetch has to be set in the URL.
6+
7+
```{eval-rst}
8+
.. jupyterlite::
9+
:width: 100%
10+
:height: 600px
11+
:prompt: Try JupyterLite!
12+
:prompt_color: #00aa42
13+
:search_params: ["branch", "repo", "urlpath"]
14+
```
15+
16+
## Parameters
17+
18+
The parameters to provide must be formatted as in `nbgitpuller`.\
19+
They can be generated with [nbgitpuller link generator](https://nbgitpuller.readthedocs.io/en/latest/link.html).
20+
21+
Currently the allowed parameters are:
22+
23+
- `repo`: the github repository to fetch
24+
- `branch`: the branch of the repository to fetch
25+
- `urlpath`: the path to a notebook file to open (relative to the root of the repository).
26+
27+
## Limitations
28+
29+
Fetching a repository uses the unauthenticated Github API to fetch each file, with a capacity of 60 files per hour
30+
see [github API](https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limits-for-requests-from-personal-accounts).
31+
32+
Do not expect to fetch a large repository with it.
33+
34+
## Try it
35+
36+
It can be tried with the current documentation, by providing parameters in the current URL of the documentation.
37+
38+
As an example the following URL will reload the current page with some repo parameters:\
39+
<https://litegitpuller.readthedocs.io/en/latest/index.html?repo=https%3A%2F%2Fgithub.com%2Fbrichet%2Ftesting-repo&urlpath=tree%2Ftesting-repo%2Fnotebooks%2Fsimple.ipynb&branch=main>

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ dependencies = [
2626
]
2727
dynamic = ["version", "description", "authors", "urls", "keywords"]
2828

29+
[project.optional-dependencies]
30+
docs = [
31+
"jupyterlite-sphinx>=0.9.3",
32+
"jupyterlite-xeus-python>=0.9.0,<0.10.0",
33+
"myst-parser",
34+
"pydata_sphinx_theme",
35+
"sphinx>=4"
36+
]
37+
2938
[tool.hatch.version]
3039
source = "nodejs"
3140

@@ -71,3 +80,10 @@ before-build-python = ["jlpm clean:all"]
7180

7281
[tool.check-wheel-contents]
7382
ignore = ["W002"]
83+
84+
[tool.hatch.envs.docs]
85+
features = ["docs"]
86+
[tool.hatch.envs.docs.scripts]
87+
build = "sphinx-build -W -b html docs docs/_build/html"
88+
watch = "sphinx-autobuild -W -b html docs docs/_build/html --host 0.0.0.0"
89+
serve = "python -m http.server --directory docs/_build/html"

0 commit comments

Comments
 (0)