Skip to content

Commit

Permalink
DOC: add stubs for documentation (#17)
Browse files Browse the repository at this point in the history
Adds the infrastructure for building documentation. Can currently only
be built locally, as the repository is still private, but will
eventually be built on ReadTheDocs.

Closes: #4
Reviewed-by: Nicolas Tessore
Co-authored-by: Nicolas Tessore <[email protected]>
  • Loading branch information
paddyroddy and ntessore authored Sep 19, 2023
1 parent 1292566 commit 2aef719
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 19 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,3 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: pipx run build
# docs:
# name: Docs
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - run: pipx run --spec '.[docs]' sphinx-build -W -b html docs _build/html
16 changes: 16 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml

python:
install:
- method: pip
path: .
extra_requirements:
- docs
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# _Heracles_ — Harmonic-space statistics on the sphere

[![PyPI](https://img.shields.io/pypi/v/heracles)](https://pypi.org/project/heracles)
[![Python](https://img.shields.io/pypi/pyversions/heracles)](https://www.python.org)
[![Documentation](https://readthedocs.org/projects/heracles/badge/?version=latest)](https://heracles.readthedocs.io/en/latest/?badge=latest)
[![Test](https://github.com/heracles-ec/heracles/actions/workflows/test.yml/badge.svg)](https://github.com/heracles-ec/heracles/actions/workflows/test.yml)

The _Heracles_ code was developed in the _Euclid_ Science Ground Segment.
3 changes: 3 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API Documentation

::: heracles
3 changes: 3 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%
include-markdown "../README.md"
%}
1 change: 1 addition & 0 deletions heracles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Main module of the *Heracles* package."""

try:
from ._version import __version__, __version_tuple__ # noqa: F401
Expand Down
14 changes: 6 additions & 8 deletions heracles/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,9 @@ def mapper(page: "CatalogPage") -> None:

_map_real(wht, val, ipix, w, v)

if page.size:
ngal += page.size
wmean += (w - wmean).sum() / ngal
var += ((w * v) ** 2 - var).sum() / ngal
ngal += page.size
wmean += (w - wmean).sum() / ngal
var += ((w * v) ** 2 - var).sum() / ngal

# the mapper function is yield-ed to be applied over the catalogue
yield mapper
Expand Down Expand Up @@ -531,10 +530,9 @@ def mapper(page: "CatalogPage") -> None:

_map_complex(wht, val, ipix, w, re, im)

if page.size:
ngal += page.size
wmean += (w - wmean).sum() / ngal
var += ((w * re) ** 2 + (w * im) ** 2 - var).sum() / ngal
ngal += page.size
wmean += (w - wmean).sum() / ngal
var += ((w * re) ** 2 + (w * im) ** 2 - var).sum() / ngal

# the mapper function is yield-ed to be applied over the catalogue
yield mapper
Expand Down
46 changes: 46 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
site_name: Heracles
site_url: https://heracles.readthedocs.io
nav:
- Home: index.md
- API: api.md
theme:
name: material
palette:
# palette toggle for dark mode
- scheme: slate
toggle:
icon: material/brightness-4
name: Switch to light mode
# palette toggle for light mode
- scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
plugins:
- include-markdown
- mkdocstrings:
handlers:
python:
options:
# general
allow_inspection: false
show_bases: false
show_source: false
# headings
show_category_heading: true
show_object_full_path: false
show_root_toc_entry: true
# members
filters: ["!^__?"]
inherited_members: true
show_submodules: false
# docstrings
docstring_options:
ignore_init_summary: true
docstring_section_style: spacy
merge_init_into_class: true
show_if_no_docstring: true
# signatures
line_length: 80
show_signature: false
- search
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ classifiers = [
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Astronomy",
]
dependencies = [
Expand All @@ -30,11 +34,10 @@ dynamic = [
license = "LGPL-3.0-or-later"
name = "heracles"
optional-dependencies = {docs = [
"furo",
"matplotlib",
"numpydoc",
"sphinx",
"sphinxcontrib-katex",
"mkdocs",
"mkdocs-include-markdown-plugin",
"mkdocs-material",
"mkdocstrings[python]",
], test = [
"pytest",
"pytest-rerunfailures",
Expand Down

0 comments on commit 2aef719

Please sign in to comment.