Skip to content

Commit

Permalink
DOC: template for sphinx documentation (#146)
Browse files Browse the repository at this point in the history
Add a template for the Sphinx documentation. This is a reasonably
comprehensive first draft, but we anticipate that all of the
documentation will be updated and polished for public consumption in a
future issue.

Closes: #116
  • Loading branch information
ucapbba authored Aug 13, 2024
1 parent f92f0d3 commit 117f732
Show file tree
Hide file tree
Showing 20 changed files with 209 additions and 57 deletions.
5 changes: 4 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

mkdocs:
configuration: mkdocs.yml

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_static/Heracles.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/api.md

This file was deleted.

56 changes: 56 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#


# -- Project information -----------------------------------------------------

from importlib import metadata

project = "heracles"
author = "Euclid Science Ground Segment"
version = metadata.version(project)
release = version


# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"numpydoc",
"sphinx.ext.intersphinx",
"sphinxcontrib.katex",
"matplotlib.sphinxext.plot_directive",
]

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}

templates_path = ["_templates"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_logo = "_static/Heracles.jpg"
3 changes: 0 additions & 3 deletions docs/index.md

This file was deleted.

16 changes: 16 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

***************************************************************
*HERACLES* --- Harmonic-space statistics on the sphere
***************************************************************

.. image:: _static/Heracles.jpg

=================
Table of Contents
=================
.. toctree::
:maxdepth: 2

manual/index
user/index
reference/index
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
6 changes: 6 additions & 0 deletions docs/manual/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Examples
========

The best way to get started with *Heracles* is to follow the GitHub example__.

__ https://github.com/heracles-ec/heracles/blob/main/examples/example.ipynb
10 changes: 10 additions & 0 deletions docs/manual/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
===============
Software manual
===============

.. toctree::
:maxdepth: 2

installation
Examples
releases
18 changes: 18 additions & 0 deletions docs/manual/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Installation
============

Requirements
------------

*Heracles* is auto tested on Python versions 3.8 - 3.12. For now there is no official release so we recommend developer installation only.


Developer installation
----------------------

If you want to install *Heracles* for local development, clone the repository and
install the package in editable mode::

$ pip install -e .

This will automatically add Heracles modules to your python path so that you can import into you Python codes.
6 changes: 6 additions & 0 deletions docs/manual/releases.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Releases
========

You may check for releases here:

https://github.com/heracles-ec/heracles/releases/
8 changes: 8 additions & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==================
Function reference
==================

.. toctree::
:maxdepth: 1

twopoint
5 changes: 5 additions & 0 deletions docs/reference/twopoint.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
==============================
Example twopoint documentation
==============================

Documentation to be written 'by hand' without use of automodule
4 changes: 4 additions & 0 deletions docs/user/how-heracles-works.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

How *Heracles* works
====================
Todo
9 changes: 9 additions & 0 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
==========
User guide
==========

.. toctree::
:maxdepth: 2

how-heracles-works
publications
4 changes: 4 additions & 0 deletions docs/user/publications.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Publications
============

Publications are coming - watch this space!
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
- healpy
- numba
- numpy
- matplotlib
- pip
- pip:
- convolvecl
Expand Down
46 changes: 0 additions & 46 deletions mkdocs.yml

This file was deleted.

11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ dynamic = [
license = "LGPL-3.0-or-later"
name = "heracles"
optional-dependencies = {all = [
"matplotlib",
"rich",
], docs = [
"mkdocs",
"mkdocs-include-markdown-plugin",
"mkdocs-material",
"mkdocstrings[python]",
"furo",
"matplotlib",
"numpydoc",
"sphinx",
"sphinxcontrib-katex",
], test = [
"matplotlib",
"pytest",
"pytest-rerunfailures",
]}
Expand Down

0 comments on commit 117f732

Please sign in to comment.