Skip to content

Commit

Permalink
docs: Update docs with Jupyter Book and NumPy docstrings (#110)
Browse files Browse the repository at this point in the history
This is a PR from uw-ssec#25.

This improved the documentation to use Jupyter Book instead of vanilla
sphinx. Google docstring style has been updated to Numpy docstring style.

---

Ref: uw-ssec#11
Original author: https://github.com/sophietao127

- docs: Add tutorials
- Added index.md to tutorials
- Updated _config.yml and _toc.yml
- docs: Lint docs and update notebooks

---------

Co-authored-by: Landung 'Don' Setiawan <[email protected]>
  • Loading branch information
uwcdc and lsetiawan authored Dec 8, 2023
1 parent 2b2ef5b commit 541f265
Show file tree
Hide file tree
Showing 59 changed files with 4,017 additions and 1,434 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/postBuild.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# For writing commands that will be executed after the container is created

# Installs `caustic` as local library without resolving dependencies (--no-deps)
# Installs `caustics` as local library without resolving dependencies (--no-deps)
python3 -m pip install -e /workspaces/caustics --no-deps
python3 -m pip install -e ".[dev]"
12 changes: 6 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ install `nox`:

## Codespaces

Nox is pre-installed in the Codespaces environment. So, after activating a Codespace,
you can just open the terminal and run `nox` to run all the checks and tests.
Nox is pre-installed in the Codespaces environment. So, after activating a
Codespace, you can just open the terminal and run `nox` to run all the checks
and tests.

## Local

Expand All @@ -32,10 +33,9 @@ brew install nox

### What is it?

`nox` is a command-line tool that automates testing in multiple Python environments,
similar to tox. Unlike tox,
Nox uses a standard Python file for configuration,
you can find this configuration in [`noxfile.py`](../noxfile.py).
`nox` is a command-line tool that automates testing in multiple Python
environments, similar to tox. Unlike tox, Nox uses a standard Python file for
configuration, you can find this configuration in [`noxfile.py`](../noxfile.py).

### How do I use it?

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,7 @@ package.json

# version
_version.py

# Jupyter book
conf.py
caustics*.rst
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
exclude: |
(?x)^(
tests/utils.py |
.devcontainer/ |
docs/source/
.devcontainer/
)
ci:
Expand Down Expand Up @@ -77,6 +76,12 @@ repos:
hooks:
- id: shellcheck

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
args: [--extra-keys=metadata.kernelspec metadata.language_info.version]

- repo: local
hooks:
- id: disallow-caps
Expand Down
8 changes: 7 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ build:
python: "3.9"
apt_packages:
- pandoc # Specify pandoc to be installed via apt-get
- graphviz # Specify graphviz to be installed via apt-get
jobs:
pre_build:
# Generate the Sphinx configuration for this Jupyter Book so it builds.
- "jupyter-book config sphinx docs/source/"
- "sphinx-apidoc -f -o docs/source/ src/caustics/"

python:
install:
- requirements: requirements.txt # Path to your requirements.txt file
- requirements: docs/requirements.txt # Path to your requirements.txt file
- requirements: requirements.txt # Path to your requirements.txt file
- method: pip
path: . # Install the package itself
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) [2023] [caustic authors]
Copyright (c) [2023] [caustics authors]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ pip install caustics

## Documentation

Please see our [documentation page](https://caustics.readthedocs.io/en/latest/) for
more detailed information.
Please see our [documentation page](https://caustics.readthedocs.io/en/latest/)
for more detailed information.

## Contribution

We welcome contributions from collaborators and researchers interested in our
work. If you have improvements, suggestions, or new findings to share, please
submit an issue or pull request. Your contributions help advance our research and analysis
efforts.
submit an issue or pull request. Your contributions help advance our research
and analysis efforts.

To get started with your development (or fork), click the "Open with GitHub
Codespaces" button below to launch a fully configured development environment
Expand Down
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nbsphinx
jupyter-book
sphinx
sphinx_rtd_theme
wheel
matplotlib
ipywidgets
47 changes: 47 additions & 0 deletions docs/source/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Book settings
# Learn more at https://jupyterbook.org/customize/config.html

title: Caustics
author: Ciela Institute
logo: ../../media/caustics_logo.png

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: force
allow_errors: false
# Per-cell notebook execution limit (seconds)
timeout: 10

# Define the name of the latex output file for PDF builds
latex:
latex_documents:
targetname: book.tex

# Add a bibtex file so that we can create citations
# bibtex_bibfiles:
# - references.bib

# Information about where the book exists on the web
repository:
url: https://github.com/Ciela-Institute/caustics # Online location of your book
path_to_book: docs/source # Optional path to your book, relative to the repository root
branch: main # Which branch of the repository should be used when creating links (optional)

# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html:
favicon: ../../media/caustics_favicon.ico
use_issues_button: true
use_repository_button: true

sphinx:
extra_extensions:
- "sphinx.ext.autodoc"
- "sphinx.ext.autosummary"
- "sphinx.ext.napoleon"
- "sphinx.ext.doctest"
- "sphinx.ext.coverage"
- "sphinx.ext.mathjax"
- "sphinx.ext.ifconfig"
- "sphinx.ext.viewcode"
21 changes: 21 additions & 0 deletions docs/source/_toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Table of contents
# Learn more at https://jupyterbook.org/customize/toc.html

format: jb-book
root: intro
chapters:
- file: getting_started
- file: install
- file: tutorials/index
sections:
- file: tutorials/BasicIntroduction
- file: tutorials/LensZoo
- file: tutorials/VisualizeCaustics
- file: tutorials/MultiplaneDemo
- file: tutorials/InvertLensEquation
- file: tutorials/Simulators
- file: tutorials/Playground
- file: contributing
- file: citation
- file: license
- file: modules
2 changes: 1 addition & 1 deletion docs/source/citation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Citation
========

Paper comming soon! We will put all the citation information here when its ready.
Paper coming soon! We will put all the citation information here when its ready.
187 changes: 0 additions & 187 deletions docs/source/conf.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Thanks for helping make caustics better! Here you will learn the full process ne
Create An Issue
---------------

Before actually writing any code, its best to create an issue on the GitHub. Describe the issue in detail and let us know the desired solution. Here it will be possible to address concerns (maybe its aready solved and just not yet documented) and plan out the best solution. We may also assign someone to work on it if that seems better. Note that submitting an issue is a contribution to caustics, we appreciate your ideas! Still, if after discussion it seems that the problem does need some work and you're the person to do it, then we can move on to the next steps.
Before actually writing any code, its best to create an issue on the GitHub. Describe the issue in detail and let us know the desired solution. Here it will be possible to address concerns (maybe its already solved and just not yet documented) and plan out the best solution. We may also assign someone to work on it if that seems better. Note that submitting an issue is a contribution to caustics, we appreciate your ideas! Still, if after discussion it seems that the problem does need some work and you're the person to do it, then we can move on to the next steps.

1. Navigate to the **Issues** tab of the GitHub repository.
2. Click on **New Issue**.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ We have created a repository of tutorial Jupyter notebooks that can help initiat
Read The Docs
-------------

Docs for all the main functions in caustics are avaialble at :doc:`caustics` at varying degrees of completeness. Further development of the docs is always ongoing.
Docs for all the main functions in caustics are available at :doc:`caustics` at varying degrees of completeness. Further development of the docs is always ongoing.
Loading

0 comments on commit 541f265

Please sign in to comment.