Skip to content

Commit 5926fc1

Browse files
xgarridosgiardie
andauthored
Add resources for documentation (#74)
* Add resources for documentation * start from empty directory * run notebook execution for the latest python compiler * fix again * double quote -> single quote * add missing readthedocs configuration * Hackish solution to badly formated pandas dataframe due to latex expression See jupyter-book/jupyter-book#1826 * don't need this one * fix missing dep * fix sacc tutorial link + add new project dependency for notebook compilation * split unit test and testing tutorial notebooks Both tests can be done in parallel and speed up the github actions time * Add API module (time for docstrings now) * fix missing mflike path * add mock imports * adding api reference * adding mflike.rst * fixing index.rst * fixing theoryforge.rst title * escape **kwargs arguments in documentation + kozmetix * change section order * fix import (was working but don't know how) --------- Co-authored-by: sgiardie <grdsrn1@unife.it>
1 parent dcf80a0 commit 5926fc1

24 files changed

+3897
-1574
lines changed

.github/workflows/notebooks.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Testing tutorial notebooks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest]
15+
python-version: ["3.11"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies via pip
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install .[notebook]
29+
30+
- name: Test notebooks
31+
run: |
32+
cd docs/source/notebooks
33+
make

.github/workflows/testing.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing
1+
name: Testing & coverage
22

33
on:
44
pull_request:
@@ -41,9 +41,3 @@ jobs:
4141
- name: Report Coverage (codecov)
4242
if: matrix.os == 'ubuntu-latest'
4343
uses: codecov/codecov-action@v4
44-
45-
- name: Test notebooks (Only on Linux for saving time)
46-
if: matrix.os == 'ubuntu-latest'
47-
run: |
48-
python -m pip install jupyter
49-
jupyter nbconvert --to notebook --execute notebooks/mflike_tutorial.ipynb

.readthedocs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .readthedocs.yml
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 version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
14+
# Build documentation in the docs/ directory with Sphinx
15+
sphinx:
16+
configuration: docs/source/conf.py
17+
18+
# Build documentation with MkDocs
19+
#mkdocs:
20+
# configuration: mkdocs.yml
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
formats: all
24+
25+
# Optionally declare the Python requirements required to build your docs
26+
python:
27+
install:
28+
- requirements: docs/requirements.txt

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ An external likelihood using `cobaya <https://github.com/CobayaSampler/cobaya>`_
1010
.. image:: https://img.shields.io/github/actions/workflow/status/simonsobs/LAT_MFLike/testing.yml?branch=master
1111
:target: https://github.com/simonsobs/LAT_MFLike/actions
1212

13+
.. image:: https://readthedocs.org/projects/lat-mflike/badge/?version=latest
14+
:target: https://lat-mflike.readthedocs.io/en/latest/?badge=latest
15+
1316
.. image:: https://mybinder.org/badge_logo.svg
1417
:target: https://mybinder.org/v2/gh/simonsobs/LAT_MFLike/master?filepath=notebooks%2Fmflike_tutorial.ipynb
1518

16-
1719
.. image:: https://codecov.io/gh/simonsobs/LAT_MFLike/branch/master/graph/badge.svg?token=qrrVcbNCs5
1820
:target: https://codecov.io/gh/simonsobs/LAT_MFLike
1921

binder/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
matplotlib
22
camb
33
mflike
4+
seaborn

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sphinx-book-theme
2+
sphinx-copybutton
3+
myst-nb
4+
cobaya

docs/source/_static/css/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
button.theme-switch-button {
2+
display: none !important;
3+
}
4+
5+
.logo__title {
6+
font-size: 1.1rem !important;
7+
font-weight: bold !important;
8+
}

docs/source/_static/logo.png

22.2 KB
Loading

docs/source/conf.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from pkg_resources import DistributionNotFound, get_distribution
2+
3+
try:
4+
__version__ = get_distribution("mflike").version
5+
except DistributionNotFound:
6+
__version__ = "unknown version"
7+
8+
import os
9+
import sys
10+
11+
sys.path.append(os.path.abspath("../.."))
12+
# autodoc_mock_imports = ["numpy", "cobaya"]
13+
14+
# General stuff
15+
extensions = [
16+
"sphinx.ext.autodoc",
17+
"sphinx.ext.intersphinx",
18+
"sphinx.ext.napoleon",
19+
"sphinx.ext.mathjax",
20+
"sphinx.ext.viewcode",
21+
"sphinx_copybutton",
22+
"myst_nb",
23+
]
24+
25+
myst_enable_extensions = ["dollarmath", "colon_fence"]
26+
source_suffix = ".rst"
27+
master_doc = "index"
28+
29+
project = "mflike"
30+
copyright = "2019 - 2024, Simons Observatory Collaboration Analysis Library Task Force"
31+
author = "Simons Observatory Collaboration Power Spectrum Group"
32+
language = "en"
33+
version = __version__
34+
release = __version__
35+
36+
exclude_patterns = ["_build"]
37+
38+
39+
# HTML theme
40+
html_theme = "sphinx_book_theme"
41+
# Add paths to extra static html files from notebook conversion
42+
html_copy_source = True
43+
html_show_sourcelink = True
44+
html_sourcelink_suffix = ""
45+
html_title = "Multifrequency Likelihood for SO Large Aperture Telescope"
46+
html_favicon = "_static/logo.png"
47+
html_static_path = ["_static"]
48+
html_css_files = ["css/custom.css"]
49+
html_theme_options = {
50+
"logo": {
51+
"alt_text": "LAT_MFLike - Home",
52+
"text": html_title,
53+
"image_light": "_static/logo.png",
54+
},
55+
"path_to_docs": "docs",
56+
"repository_url": "https://github.com/simonsobs/LAT_MFLike",
57+
"repository_branch": "master",
58+
"launch_buttons": {
59+
"binderhub_url": "https://mybinder.org",
60+
"notebook_interface": "classic",
61+
},
62+
"use_edit_page_button": True,
63+
"use_issues_button": True,
64+
"use_repository_button": True,
65+
"use_download_button": True,
66+
}
67+
nb_execution_mode = "off"
68+
nb_execution_timeout = -1

0 commit comments

Comments
 (0)