Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #62

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1b4a054
Add sphinx docs configs
obackhouse Apr 12, 2024
c1a6df7
Include docs makefiles
obackhouse Apr 12, 2024
0088407
Add docs to CI
obackhouse Apr 12, 2024
efec5d7
Add sphinx to dev deps
obackhouse Apr 12, 2024
cee839a
Disable CI for now
obackhouse Apr 12, 2024
2277d83
Build docs in workflow
obackhouse Apr 12, 2024
9ea6a0a
Update links
obackhouse Apr 12, 2024
78453c7
Add links and README to homepage
obackhouse Apr 12, 2024
41899c3
Trying again
obackhouse Apr 12, 2024
f631f2e
Trying mkdir first
obackhouse Apr 12, 2024
fe1f726
Customise conf.py
obackhouse Apr 12, 2024
f83a208
Customise Makefile
obackhouse Apr 12, 2024
8133092
Add caption for API page
obackhouse Apr 12, 2024
7a75815
Re-enable echo for adding in README
obackhouse Apr 12, 2024
17fddfa
Linting
obackhouse Apr 12, 2024
e780c70
Updating sphinx config
obackhouse Apr 12, 2024
ad1b317
Improvements to API docs
obackhouse Apr 12, 2024
e1591af
Navigation to API working
obackhouse Apr 13, 2024
58676c4
Merge branch 'master' into sphinx-docs
obackhouse Apr 13, 2024
8bdbdf0
Update README to work with RST conversion
obackhouse Apr 13, 2024
6ebf419
Add github badges
obackhouse Apr 13, 2024
73feb33
More configuration
obackhouse Apr 13, 2024
5de4f5d
Refactor _opts internal to dict
obackhouse Apr 13, 2024
81720af
Implemented __setattr__
obackhouse Apr 13, 2024
9bfe237
Refactor to _defaults with _opts set at object runtime
obackhouse Apr 13, 2024
6c63767
Fix fsGW options
obackhouse Apr 13, 2024
8bb2bb2
Make frozen a keyword argument
obackhouse Apr 13, 2024
e482d55
Merge branch 'opts_dict' into sphinx-docs
obackhouse Apr 13, 2024
b2c267b
Now showing inherited members
obackhouse Apr 13, 2024
e109fdb
Remove leftover pyscf size functions
obackhouse Apr 13, 2024
2b61226
RTD themes
obackhouse Apr 14, 2024
b8969fc
jinja2 templates for API docs
obackhouse Apr 14, 2024
dd2aeee
Don't keep reST files
obackhouse Apr 14, 2024
ab50f3b
Change author and copyright to Booth Group
obackhouse Apr 14, 2024
55e8d3f
Add missing dev dep
obackhouse Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ jobs:
python -m black . --diff --check --verbose
python -m isort . --diff --check-only --verbose
python -m flake8 momentGW/ --verbose
- name: Run unit tests
#- name: Run unit tests
# run: |
# python -m pip install pytest pytest-cov
# pytest --cov momentGW/
- name: Build documentation
run: |
python -m pip install pytest pytest-cov
pytest --cov momentGW/
cd docs
make html
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ The `examples` directory contains more detailed usage examples.
### Publications

The methods implemented in this package have been described in the following papers:
- [*"A 'moment-conserving' reformulation of GW theory"*](https://doi.org/10.1063/5.0143291)
- [A 'moment-conserving' reformulation of GW theory](https://doi.org/10.1063/5.0143291), *J. Chem. Phys.* 158, 124102 (2023).

The data presented in the publications can be found in the `benchmark` directory.

### Contributing

Contributions are welcome, and can be made by submitting a pull request to the `master` branch.
The code uses [NumPy-style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html) and is formatted using [`black`](https://black.readthedocs.io/en/stable/), [`isort`](https://pycqa.github.io/isort/), [`ssort`](https://github.com/bwhmather/ssort), and [`flake8`](https://flake8.pycqa.org/en/latest/).
The code uses [NumPy-style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html) and is formatted using [black](https://black.readthedocs.io/en/stable/), [isort](https://pycqa.github.io/isort/), [ssort](https://github.com/bwhmather/ssort), and [flake8](https://flake8.pycqa.org/en/latest/).
21 changes: 21 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

html:
sphinx-build -M html . _build

postprocess:
# Post-processing generated files:
# If there is a line with a "Duplicate implicit target name" error, remove it:
for file in `find _build/html -name "*.html"`; do \
sed -i '/Duplicate implicit target name/d' $$file; \
done

docs: html postprocess

clean:
rm -rf _build autoapi

.PHONY: html postprocess clean
7 changes: 7 additions & 0 deletions docs/_templates/autoapi/base/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. {{ obj.type }}:: {{ obj.name }}

{% if summary %}

{{ obj.summary }}

{% endif %}
15 changes: 15 additions & 0 deletions docs/_templates/autoapi/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
API Reference
=============

This page contains auto-generated API reference documentation [#f1]_.

.. toctree::
:titlesonly:

{% for page in pages %}
{% if page.top_level_object and page.display %}
{{ page.include_path }}
{% endif %}
{% endfor %}

.. [#f1] Created with `sphinx-autoapi <https://github.com/readthedocs/sphinx-autoapi>`_
1 change: 1 addition & 0 deletions docs/_templates/autoapi/python/attribute.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "python/data.rst" %}
60 changes: 60 additions & 0 deletions docs/_templates/autoapi/python/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{% if obj.display %}
.. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}

{% for (args, return_annotation) in obj.overloads %}
{{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %}

{% endfor %}


{% if obj.bases %}
{% if "show-inheritance" in autoapi_options %}
Bases: {% for base in obj.bases %}{{ base|link_objs }}{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}


{% if "show-inheritance-diagram" in autoapi_options and obj.bases != ["object"] %}
.. autoapi-inheritance-diagram:: {{ obj.obj["full_name"] }}
:parts: 1
{% if "private-members" in autoapi_options %}
:private-bases:
{% endif %}

{% endif %}
{% endif %}
{% if obj.docstring %}
{{ obj.docstring|indent(3) }}
{% endif %}
{% if "inherited-members" in autoapi_options %}
{% set visible_classes = obj.classes|selectattr("display")|list %}
{% else %}
{% set visible_classes = obj.classes|rejectattr("inherited")|selectattr("display")|list %}
{% endif %}
{% for klass in visible_classes %}
{{ klass.render()|indent(3) }}
{% endfor %}
{% if "inherited-members" in autoapi_options %}
{% set visible_properties = obj.properties|selectattr("display")|list %}
{% else %}
{% set visible_properties = obj.properties|rejectattr("inherited")|selectattr("display")|list %}
{% endif %}
{% for property in visible_properties %}
{{ property.render()|indent(3) }}
{% endfor %}
{% if "inherited-members" in autoapi_options %}
{% set visible_attributes = obj.attributes|selectattr("display")|list %}
{% else %}
{% set visible_attributes = obj.attributes|rejectattr("inherited")|selectattr("display")|list %}
{% endif %}
{% for attribute in visible_attributes %}
{{ attribute.render()|indent(3) }}
{% endfor %}
{% if "inherited-members" in autoapi_options %}
{% set visible_methods = obj.methods|selectattr("display")|list %}
{% else %}
{% set visible_methods = obj.methods|rejectattr("inherited")|selectattr("display")|list %}
{% endif %}
{% for method in visible_methods %}
{{ method.render()|indent(3) }}
{% endfor %}
{% endif %}
37 changes: 37 additions & 0 deletions docs/_templates/autoapi/python/data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% if obj.display %}
.. py:{{ obj.type }}:: {{ obj.name }}
{%- if obj.annotation is not none %}

:type: {%- if obj.annotation %} {{ obj.annotation }}{%- endif %}

{%- endif %}

{%- if obj.value is not none %}

:value: {% if obj.value is string and obj.value.splitlines()|count > 1 -%}
Multiline-String

.. raw:: html

<details><summary>Show Value</summary>

.. code-block:: python

"""{{ obj.value|indent(width=8,blank=true) }}"""

.. raw:: html

</details>

{%- else -%}
{%- if obj.value is string -%}
{{ "%r" % obj.value|string|truncate(100) }}
{%- else -%}
{{ obj.value|string|truncate(100) }}
{%- endif -%}
{%- endif %}
{%- endif %}


{{ obj.docstring|indent(3) }}
{% endif %}
1 change: 1 addition & 0 deletions docs/_templates/autoapi/python/exception.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "python/class.rst" %}
15 changes: 15 additions & 0 deletions docs/_templates/autoapi/python/function.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% if obj.display %}
.. py:function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}

{% for (args, return_annotation) in obj.overloads %}
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}

{% endfor %}
{% for property in obj.properties %}
:{{ property }}:
{% endfor %}

{% if obj.docstring %}
{{ obj.docstring|indent(3) }}
{% endif %}
{% endif %}
19 changes: 19 additions & 0 deletions docs/_templates/autoapi/python/method.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{%- if obj.display %}
.. py:method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}

{% for (args, return_annotation) in obj.overloads %}
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}

{% endfor %}
{% if obj.properties %}
{% for property in obj.properties %}
:{{ property }}:
{% endfor %}

{% else %}

{% endif %}
{% if obj.docstring %}
{{ obj.docstring|indent(3) }}
{% endif %}
{% endif %}
104 changes: 104 additions & 0 deletions docs/_templates/autoapi/python/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{% if not obj.display %}
:orphan:

{% endif %}
:py:mod:`{{ obj.name }}`
=========={{ "=" * obj.name|length }}

.. py:module:: {{ obj.name }}

{% if obj.docstring %}
.. autoapi-nested-parse::

{{ obj.docstring|indent(3) }}

{% endif %}

{% block subpackages %}
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
{% if visible_subpackages %}

{% endif %}
{% endblock %}
{% block submodules %}
{% set visible_submodules = obj.submodules|selectattr("display")|list %}
{% if visible_submodules %}
Submodules
----------
.. toctree::
:titlesonly:
:maxdepth: 1

{% for submodule in visible_submodules %}
{{ submodule.short_name }}/index.rst
{% endfor %}


{% endif %}
{% endblock %}
{% block content %}
{% if obj.all is not none %}
{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %}
{% elif obj.type is equalto("package") %}
{% set visible_children = obj.children|selectattr("display")|list %}
{% else %}
{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %}
{% endif %}
{% if visible_children %}
{{ obj.type|title }} Contents
{{ "-" * obj.type|length }}---------

{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %}
{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %}
{% set visible_attributes = visible_children|selectattr("type", "equalto", "data")|list %}
{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %}
{% block classes scoped %}
{% if visible_classes %}
Classes
~~~~~~~

.. autoapisummary::

{% for klass in visible_classes %}
{{ klass.id }}
{% endfor %}


{% endif %}
{% endblock %}

{% block functions scoped %}
{% if visible_functions %}
Functions
~~~~~~~~~

.. autoapisummary::

{% for function in visible_functions %}
{{ function.id }}
{% endfor %}


{% endif %}
{% endblock %}

{% block attributes scoped %}
{% if visible_attributes %}
Attributes
~~~~~~~~~~

.. autoapisummary::

{% for attribute in visible_attributes %}
{{ attribute.id }}
{% endfor %}


{% endif %}
{% endblock %}
{% endif %}
{% for obj_item in visible_children %}
{{ obj_item.render()|indent(0) }}
{% endfor %}
{% endif %}
{% endblock %}
1 change: 1 addition & 0 deletions docs/_templates/autoapi/python/package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "python/module.rst" %}
15 changes: 15 additions & 0 deletions docs/_templates/autoapi/python/property.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%- if obj.display %}
.. py:property:: {{ obj.short_name }}
{% if obj.annotation %}
:type: {{ obj.annotation }}
{% endif %}
{% if obj.properties %}
{% for property in obj.properties %}
:{{ property }}:
{% endfor %}
{% endif %}

{% if obj.docstring %}
{{ obj.docstring|indent(3) }}
{% endif %}
{% endif %}
6 changes: 6 additions & 0 deletions docs/_templates/badges.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="momentgw-badges">
<a class="github-button" href="https://github.com/{{theme_github_user}}/{{theme_github_repo}}" data-size="large"
data-show-count="true" aria-label="Star {{ theme_github_user }}/{{ theme_github_repo }} on GitHub">Star</a>
</div>

<script async defer src="https://buttons.github.io/buttons.js"></script>
Loading
Loading