Skip to content

Commit

Permalink
Add documentation with Jupyterlite demo (#8)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
brichet committed Sep 13, 2023
1 parent d654a6e commit 42fb51c
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "mambaforge-4.10"
nodejs: "18"

sphinx:
builder: html
configuration: docs/conf.py

conda:
environment: docs-environment.yml
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# litegitpuller

[![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)
[![Github Actions Status](https://github.com/jupyterlite/litegitpuller/workflows/Build/badge.svg)](https://github.com/jupyterlite/litegitpuller/actions/workflows/build.yml)

A jupyterlite extension to automate cloning of a github repository.

## Docs

https://litegitpuller.readthedocs.io/en/latest/index.html

## Requirements

- JupyterLab >= 3.0
Expand Down
8 changes: 8 additions & 0 deletions docs-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: litegitpuller-docs
channels:
- conda-forge
dependencies:
- pip
- jupyterlite-xeus-python >=0.9.0,<0.10.0
- pip:
- .[docs]
25 changes: 25 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Configuration file for the Sphinx documentation builder.

project = 'litegitpuller'
copyright = '2023, Jupyter Development Team'
author = 'Jupyter Development Team'

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

extensions = [
'jupyterlite_sphinx',
'myst_parser',
]

templates_path = ['_templates']
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static']

jupyterlite_bind_ipynb_suffix = False
39 changes: 39 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# litegitpuller

A Jupyterlab/jupyterlite extension to fetch github repositories.

As for [nbgitpuller](https://github.com/jupyterhub/nbgitpuller), information about the repository to fetch has to be set in the URL.

```{eval-rst}
.. jupyterlite::
:width: 100%
:height: 600px
:prompt: Try JupyterLite!
:prompt_color: #00aa42
:search_params: ["branch", "repo", "urlpath"]
```

## Parameters

The parameters to provide must be formatted as in `nbgitpuller`.\
They can be generated with [nbgitpuller link generator](https://nbgitpuller.readthedocs.io/en/latest/link.html).

Currently the allowed parameters are:

- `repo`: the github repository to fetch
- `branch`: the branch of the repository to fetch
- `urlpath`: the path to a notebook file to open (relative to the root of the repository).

## Limitations

Fetching a repository uses the unauthenticated Github API to fetch each file, with a capacity of 60 files per hour
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).

Do not expect to fetch a large repository with it.

## Try it

It can be tried with the current documentation, by providing parameters in the current URL of the documentation.

As an example the following URL will reload the current page with some repo parameters:\
<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>
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ dependencies = [
]
dynamic = ["version", "description", "authors", "urls", "keywords"]

[project.optional-dependencies]
docs = [
"jupyterlite-sphinx>=0.9.3",
"jupyterlite-xeus-python>=0.9.0,<0.10.0",
"myst-parser",
"pydata_sphinx_theme",
"sphinx>=4"
]

[tool.hatch.version]
source = "nodejs"

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

[tool.check-wheel-contents]
ignore = ["W002"]

[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
build = "sphinx-build -W -b html docs docs/_build/html"
watch = "sphinx-autobuild -W -b html docs docs/_build/html --host 0.0.0.0"
serve = "python -m http.server --directory docs/_build/html"

0 comments on commit 42fb51c

Please sign in to comment.