Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:NREL/moa_python into develop-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrederik-nrel committed Nov 9, 2023
2 parents 1cde36a + 47f67d5 commit 240ea79
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deploy-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: deploy-pages

on:
push:
branches:
- develop
- main
paths:
- docs/**

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
pip install -e ".[docs]"
# Build the book
- name: Build the book
working-directory: ${{runner.workspace}}/moa_python/docs/
run: |
jupyter-book build .
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
Empty file added docs/.nojekyll
Empty file.
72 changes: 72 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Book settings
# Learn more at https://jupyterbook.org/customize/config.html

title: MOA_PYTHON
author: National Renewable Energy Laboratory
logo: gch.gif
copyright: '2023'
only_build_toc_files: false

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: auto

# 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/NREL/moa_python
path_to_book: docs
branch: main

# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html:
use_issues_button: true
use_repository_button: true
use_edit_page_button: true
google_analytics_id: G-MFDS2PT9BG


# Sphinx for API doc generation
sphinx:
extra_extensions:
- 'sphinx.ext.autodoc'
- 'sphinx.ext.autosummary'
- 'sphinx.ext.viewcode'
- 'sphinx_autodoc_typehints'
- 'sphinxcontrib.autoyaml'
- 'sphinx.ext.napoleon' # Formats google and numpy docstring styles
- 'sphinxcontrib.mermaid'
config:
html_theme: sphinx_book_theme
templates_path:
- '_templates'
language: 'python'
autoyaml_level: 3
autosummary_generate: true

# Autodoc config reference
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
autodoc_default_options:
members: true
member-order: bysource
undoc-members: true
private-members: true
# special-members: true
# inherited-members
# show-inheritance
# ignore-module-all
# imported-members: true
# exclude-members
# class-doc-from
# no-value
autodoc_typehints: both
34 changes: 34 additions & 0 deletions docs/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:
:special-members: __call__, __add__, __mul__

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods %}
{%- if not item.startswith('_') %}
~{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
66 changes: 66 additions & 0 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:nosignatures:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
:nosignatures:
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
9 changes: 9 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Table of contents
# Learn more at https://jupyterbook.org/customize/toc.html

format: jb-book
root: intro
parts:
- caption: Getting Started
chapters:
- file: installation
Binary file added docs/gch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added docs/installation.md
Empty file.
7 changes: 7 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# moa_python

Test line

Another line

t
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@
"jupyter"
]

EXTRAS = {
"docs": {
"jupyter-book<=0.13.3",
"sphinx-book-theme",
"sphinx-autodoc-typehints",
"sphinxcontrib-autoyaml",
"sphinxcontrib.mermaid",
},
"develop": {
"pytest",
"pre-commit",
"ruff",
"isort",
},
}

ROOT = Path(__file__).parent
with open(ROOT / "moa_python" / "version.py") as version_file:
VERSION = version_file.read().strip()
Expand Down

0 comments on commit 240ea79

Please sign in to comment.