diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..88982c5 --- /dev/null +++ b/.readthedocs.yml @@ -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 diff --git a/README.md b/README.md index 613078b..b3a0256 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs-environment.yml b/docs-environment.yml new file mode 100644 index 0000000..a39f8d3 --- /dev/null +++ b/docs-environment.yml @@ -0,0 +1,8 @@ +name: litegitpuller-docs +channels: + - conda-forge +dependencies: + - pip + - jupyterlite-xeus-python >=0.9.0,<0.10.0 + - pip: + - .[docs] \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..f1772ae --- /dev/null +++ b/docs/conf.py @@ -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 \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..62a797a --- /dev/null +++ b/docs/index.md @@ -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:\ + diff --git a/pyproject.toml b/pyproject.toml index 75be13d..ec3054e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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"