Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit d6bd098

Browse files
authored
Merge pull request #2 from mpewsey/dev
Documentation updates
2 parents ffe4b60 + 2a5ac09 commit d6bd098

15 files changed

Lines changed: 160 additions & 131 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ __pycache__/
99
.pytest_cache
1010

1111
/docs/index.md
12+
docs/generated
1213

1314
# Distribution / packaging
1415
.Python

README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22

33
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/error_solver.svg)
44
![PyPI](https://img.shields.io/pypi/v/error_solver.svg)
5-
[![Build Status](https://travis-ci.com/line-mind/error_solver.svg?branch=master)](https://travis-ci.com/line-mind/error_solver)
5+
[![Build Status](https://travis-ci.com/mpewsey/error_solver.svg?branch=master)](https://travis-ci.com/mpewsey/error_solver)
66
[![Documentation Status](https://readthedocs.org/projects/error-solver/badge/?version=latest)](https://error-solver.readthedocs.io/en/latest/?badge=latest)
7-
[![codecov](https://codecov.io/gh/line-mind/error_solver/branch/master/graph/badge.svg)](https://codecov.io/gh/line-mind/error_solver)
8-
9-
<!--
10-
## Table of Contents
11-
12-
* [Error Solver](error_solver.rst)
13-
-->
7+
[![codecov](https://codecov.io/gh/mpewsey/error_solver/branch/master/graph/badge.svg)](https://codecov.io/gh/mpewsey/error_solver)
148

159
## About
1610

@@ -32,15 +26,3 @@ The above installation only install the dependencies required for the
3226
```
3327
pip install error_solver[all]
3428
```
35-
36-
<!--
37-
## Example: Error in Cylinder
38-
39-
The below example determines the propagation error tolerances for the cross
40-
sectional area `A` and volume `V` of a cylinder given the
41-
measurement tolerance for the radius `r` and height `h`.
42-
43-
```eval_rst
44-
.. literalinclude:: ../examples/error_solver_ex1.py
45-
```
46-
-->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
7+
{% block methods %}
8+
{% if methods %}
9+
.. rubric:: Methods
10+
11+
.. autosummary::
12+
:toctree:
13+
{% for item in methods %}
14+
{% if item not in ['__init__', 'get', 'copy', 'clear', 'fromkeys', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'getfield', 'partition', 'all', 'any', 'argmax', 'argmin', 'argpartition', 'argsort', 'astype', 'byteswap', 'choose', 'clip', 'compress', 'conj', 'conjugate', 'cumprod', 'cumsum', 'diagonal', 'dot', 'dump', 'dumps', 'fill', 'flatten', 'item', 'itemset', 'max', 'mean', 'min', 'newbyteorder', 'nonzero', 'portition', 'prod', 'ptp', 'put', 'ravel', 'repeat', 'reshape', 'resize', 'round', 'searchsorted', 'setfield', 'setflags', 'sort', 'squeeze', 'std', 'sum', 'swapaxes', 'take', 'tobytes', 'tofile', 'tolist', 'tostring', 'trace', 'transpose', 'var', 'view'] %}~{{ name }}.{{ item }}{% endif %}
15+
{%- endfor %}
16+
{% endif %}
17+
{% endblock %}

docs/_templates/index.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/_templates/searchbox.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{%- if pagename != "search" and builder != "singlehtml" %}
2+
<div id="searchbox" style="display: none" role="search">
3+
<h4>{{ _('Quick search') }}</h4>
4+
<div>
5+
<form class="search" action="{{ pathto('search') }}" method="get">
6+
<input type="text" style="width: inherit;" name="q" placeholder="Search"/>
7+
<!--<input type="submit" value="{{ _('search') }}" />-->
8+
<input type="hidden" name="check_keywords" value="yes" />
9+
<input type="hidden" name="area" value="default" />
10+
</form>
11+
</div>
12+
</div>
13+
<script type="text/javascript">$('#searchbox').show(0);</script>
14+
{%- endif %}

docs/conf.py

Lines changed: 31 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,32 @@
1818

1919
import os
2020
import sys
21+
import shutil
2122
from configparser import ConfigParser
22-
from recommonmark.transform import AutoStructify
23-
from recommonmark.parser import CommonMarkParser
24-
from jinja2 import Environment, FileSystemLoader, StrictUndefined
2523

2624
root = os.path.abspath(os.path.join('..'))
2725
sys.path.insert(0, root)
2826

2927
# Load metadata from setup.cfg
30-
metadata_file = os.path.join(root, 'setup.cfg')
31-
metadata = ConfigParser()
32-
metadata.read(metadata_file)
33-
metadata = metadata['metadata']
34-
35-
with open(os.path.join(root, 'README.md'), 'rt') as fh:
36-
metadata['long_description'] = fh.read()
37-
38-
# Render index.md with metadata
39-
def write_index():
40-
path = os.path.join(root, 'docs', '_templates')
41-
env = Environment(loader = FileSystemLoader(path),
42-
undefined = StrictUndefined)
43-
template = env.get_template('index.md')
44-
s = template.render(**metadata)
45-
s = s.replace('<!--', '')
46-
s = s.replace('-->', '')
47-
48-
with open(os.path.join(root, 'docs', 'index.md'), 'wt') as fh:
49-
fh.truncate()
50-
fh.write(s)
51-
52-
write_index()
28+
meta_path = os.path.join(root, 'setup.cfg')
29+
meta = ConfigParser()
30+
meta.read(meta_path)
31+
meta = meta['metadata']
32+
33+
# Clear generated documents
34+
if (not os.path.exists('_build') or len(os.listdir('_build')) == 0) and os.path.exists('generated'):
35+
shutil.rmtree('generated')
5336

5437
# -- Project information -----------------------------------------------------
5538

56-
project = metadata['project']
57-
copyright = metadata['copyright']
58-
author = metadata['author']
39+
project = meta['project']
40+
copyright = meta['copyright']
41+
author = meta['author']
5942

6043
# The short X.Y version
61-
version = metadata['version']
44+
version = meta['version']
6245
# The full version, including alpha/beta/rc tags
63-
release = metadata['version']
64-
65-
github_doc_root = 'https://github.com/line-mind/{}/tree/master/'.format(metadata['name'])
46+
release = meta['version']
6647

6748
# -- General configuration ---------------------------------------------------
6849

@@ -74,6 +55,7 @@ def write_index():
7455
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
7556
# ones.
7657
extensions = [
58+
#'matplotlib.sphinxext.plot_directive',
7759
'sphinx.ext.autodoc',
7860
'sphinx.ext.doctest',
7961
'sphinx.ext.intersphinx',
@@ -84,7 +66,7 @@ def write_index():
8466
'numpydoc',
8567
#'sphinx.ext.imgmath',
8668
'sphinx.ext.viewcode',
87-
'sphinx.ext.githubpages',
69+
#'sphinxcontrib.spelling',
8870
]
8971

9072
# Add any paths that contain templates here, relative to this directory.
@@ -96,10 +78,6 @@ def write_index():
9678
source_suffix = ['.rst', '.md']
9779
#source_suffix = '.rst'
9880

99-
source_parsers = {
100-
'.md' : CommonMarkParser
101-
}
102-
10381
# The master toctree document.
10482
master_doc = 'index'
10583

@@ -125,6 +103,7 @@ def write_index():
125103
# a list of builtin themes.
126104
#
127105
themedir = os.path.join(os.path.dirname(__file__), 'scipy-sphinx-theme', '_theme')
106+
128107
if not os.path.isdir(themedir):
129108
raise RuntimeError('Get the scipy-sphinx-theme first, '
130109
'via git submodule init && git submodule update')
@@ -137,14 +116,16 @@ def write_index():
137116
numpydoc_show_class_members = False
138117
numpydoc_show_inherited_class_members = False
139118
class_members_toctree = False
119+
autosummary_generate = True
140120

141121
html_theme_options = {
142122
"edit_link": False,
143123
"sidebar": "left",
144124
"scipy_org_logo": False,
145125
"rootlinks": []
146126
}
147-
html_sidebars = {}
127+
128+
html_sidebars = {'index': ['searchbox.html']}
148129

149130
html_title = "%s v%s Manual" % (project, version)
150131
html_last_updated_fmt = '%b %d, %Y'
@@ -174,7 +155,7 @@ def write_index():
174155
# -- Options for HTMLHelp output ---------------------------------------------
175156

176157
# Output file base name for HTML help builder.
177-
htmlhelp_basename = '{}_doc'.format(metadata['name'])
158+
htmlhelp_basename = '{}'.format(meta['name'])
178159

179160

180161
# -- Options for LaTeX output ------------------------------------------------
@@ -203,7 +184,7 @@ def write_index():
203184
# (source start file, target name, title,
204185
# author, documentclass [howto, manual, or own class]).
205186
latex_documents = [
206-
(master_doc, '{}.tex'.format(metadata['name']), '{} Documentation'.format(metadata['project']),
187+
(master_doc, '{}.tex'.format(meta['name']), '{} Documentation'.format(meta['project']),
207188
author, 'manual'),
208189
]
209190

@@ -213,7 +194,7 @@ def write_index():
213194
# One entry per manual page. List of tuples
214195
# (source start file, name, description, authors, manual section).
215196
man_pages = [
216-
(master_doc, metadata['name'], '{} Documentation'.format(metadata['project']),
197+
(master_doc, meta['name'], '{} Documentation'.format(meta['project']),
217198
[author], 1)
218199
]
219200

@@ -224,8 +205,8 @@ def write_index():
224205
# (source start file, target name, title, author,
225206
# dir menu entry, description, category)
226207
texinfo_documents = [
227-
(master_doc, metadata['name'], '{} Documentation'.format(metadata['project']),
228-
author, metadata['name'], metadata['description'],
208+
(master_doc, meta['name'], '{} Documentation'.format(meta['project']),
209+
author, meta['name'], meta['description'],
229210
'Miscellaneous'),
230211
]
231212

@@ -235,17 +216,14 @@ def write_index():
235216
# -- Options for intersphinx extension ---------------------------------------
236217

237218
# Example configuration for intersphinx: refer to the Python standard library.
238-
intersphinx_mapping = {'https://docs.python.org/': None}
219+
intersphinx_mapping = {
220+
'python': ('https://docs.python.org/3', None),
221+
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
222+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
223+
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
224+
}
239225

240226
# -- Options for todo extension ----------------------------------------------
241227

242228
# If true, `todo` and `todoList` produce output, else they produce nothing.
243229
todo_include_todos = True
244-
245-
# AutoStructify setup
246-
def setup(app):
247-
app.add_config_value('recommonmark_config', {
248-
'url_resolver': lambda url: github_doc_root + url,
249-
'auto_toc_tree_section': 'Table of Contents',
250-
}, True)
251-
app.add_transform(AutoStructify)

docs/index.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
=========================
2+
Error Solver Documenation
3+
=========================
4+
5+
.. image:: https://img.shields.io/pypi/pyversions/error_solver.svg
6+
:target: #
7+
8+
.. image:: https://img.shields.io/pypi/v/error_solver.svg
9+
:target: #
10+
11+
.. image:: https://travis-ci.com/mpewsey/error_solver.svg?branch=master
12+
:target: https://travis-ci.com/mpewsey/error_solver
13+
14+
.. image:: https://readthedocs.org/projects/error-solver/badge/?version=latest
15+
:target: https://error-solver.readthedocs.io/en/latest/?badge=latest
16+
17+
.. image:: https://codecov.io/gh/mpewsey/error_solver/branch/master/graph/badge.svg
18+
:target: https://codecov.io/gh/mpewsey/error_solver
19+
20+
About
21+
=====
22+
This package contains classes for estimating the propagation error tolerances
23+
for a system of equations.
24+
25+
Installation
26+
============
27+
28+
This package may be installed via pip:
29+
30+
.. code-block:: none
31+
32+
pip install error_solver
33+
34+
35+
The above installation only install the dependencies required for the
36+
`ErrorSolverPy` class. To also install the dependencies necessary for the
37+
`ErrorSolver` class, use the following command instead:
38+
39+
.. code-block:: none
40+
41+
pip install error_solver[all]
42+
43+
44+
Example: Error in Cylinder
45+
==========================
46+
The below example determines the propagation error tolerances for the cross
47+
sectional area `A` and volume `V` of a cylinder given the
48+
measurement tolerance for the radius `r` and height `h`.
49+
50+
.. literalinclude:: ../examples/error_solver_ex1.py
51+
52+
53+
API Documentation
54+
=================
55+
.. toctree::
56+
:maxdepth: 1
57+
58+
error_solver

error_solver/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
"""
2-
==================================
3-
Error Solver (:mod:`error_solver`)
4-
==================================
2+
===================================
3+
Error Solver (:mod:`.error_solver`)
4+
===================================
55
6-
.. automodule:: error_solver.error_solver
7-
:members:
8-
:inherited-members:
6+
The below classes are available for error propagation approximation.
97
10-
.. automodule:: error_solver.error_solver_py
11-
:members:
12-
:inherited-members:
8+
.. autosummary::
9+
:toctree: generated/
10+
11+
ErrorSolver
12+
ErrorSolverPy
1313
"""
1414

15+
try:
16+
from .error_solver import *
17+
except:
18+
pass
19+
1520
from .error_solver_py import *

error_solver/_base_error_solver.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
"""
2-
==========================================================
3-
Base Error Solver (:mod:`error_solver._base_error_solver`)
4-
==========================================================
5-
6-
Contains a class used as the base for ErrorSolver and ErrorSolverPy.
7-
"""
8-
91
import numpy as np
102
import pandas as pd
113

0 commit comments

Comments
 (0)