Skip to content

Commit eb893c6

Browse files
authored
Doc: Cleanup RTD config (#52)
* Add .readthedocs.yaml * petab * add_stylesheet * ipython * rm doc/editorial_board.rst * excludes * link all examples * set dep versions * fix docstring * ignore numpy warnings * fix docstring * ignore recommonmark warnings * Fix collections.Counter issues * move deps to setup.py * py38
1 parent 1f7ade4 commit eb893c6

File tree

9 files changed

+72
-49
lines changed

9 files changed

+72
-49
lines changed

.readthedocs.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
sphinx:
7+
configuration: doc/conf.py
8+
fail_on_warning: true
9+
10+
11+
python:
12+
version: 3.8
13+
install:
14+
- method: pip
15+
path: .
16+
extra_requirements:
17+
- doc

.rtd_pip_reqs.txt

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

doc/conf.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7+
import os
8+
import subprocess
9+
import sys
10+
import warnings
11+
712
# -- Path setup --------------------------------------------------------------
813

914
# If extensions (or modules to document with autodoc) are in another directory,
1015
# add these directories to sys.path here. If the directory is relative to the
1116
# documentation root, use os.path.abspath to make it absolute, like shown here.
1217
#
13-
import os
14-
import sys
1518
sys.path.insert(0, os.path.abspath('..'))
1619

1720
# -- Project information -----------------------------------------------------
1821

1922
project = 'PEtab'
20-
copyright = '2018-2021, the PEtab developers'
23+
copyright = '2018, the PEtab developers'
2124
author = 'PEtab developers'
2225

2326
# The full version, including alpha/beta/rc tags
2427
release = 'latest'
2528

2629
# -- Custom pre-build --------------------------------------------------------
2730

28-
import subprocess
2931

3032
subprocess.run(['python', 'md2rst.py'])
3133

@@ -49,7 +51,12 @@
4951
# List of patterns, relative to source directory, that match files and
5052
# directories to ignore when looking for source files.
5153
# This pattern also affects html_static_path and html_extra_path.
52-
exclude_patterns = ['build/doctrees', 'build/html']
54+
exclude_patterns = [
55+
'build/doctrees',
56+
'build/html',
57+
'**.ipynb_checkpoints',
58+
'logo/LICENSE.md',
59+
]
5360

5461
master_doc = 'index'
5562

@@ -72,14 +79,21 @@
7279
'.md': 'markdown',
7380
}
7481

82+
# ignore numpy warnings
83+
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
84+
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
85+
# ignore recommonmark warnings
86+
# https://github.com/readthedocs/recommonmark/issues/177
87+
warnings.filterwarnings("ignore",
88+
message="Container node skipped: type=document")
89+
7590
# -- Options for HTML output -------------------------------------------------
7691

7792
# The theme to use for HTML and HTML Help pages. See the documentation for
7893
# a list of builtin themes.
7994
#
8095
html_theme = 'sphinx_rtd_theme'
81-
def setup(app):
82-
app.add_stylesheet('custom.css')
96+
8397
# Add any paths that contain custom static files (such as style sheets) here,
8498
# relative to this directory. They are copied after the builtin static files,
8599
# so a file named "default.css" will overwrite the builtin "default.css".
@@ -94,3 +108,14 @@ def setup(app):
94108
}
95109

96110
html_logo = 'logo/PEtab.png'
111+
112+
113+
def skip_some_objects(app, what, name, obj, skip, options):
114+
"""Exclude some objects from the documentation"""
115+
if getattr(obj, '__module__', None) == 'collections':
116+
return True
117+
118+
119+
def setup(app):
120+
"""Sphinx setup"""
121+
app.connect('autodoc-skip-member', skip_some_objects)

doc/editorial_board.rst

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

doc/example.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The following examples should help to get a better idea of how to use the PEtab
1010

1111
example/example_petablint.ipynb
1212
example/example_visualization.ipynb
13+
example/example_visualization_without_visspec.ipynb
14+
example/example_visualization_with_visspec.ipynb
1315

1416
Examples of systems biology parameter estimation problems specified in PEtab
1517
can be found in the `systems biology benchmark model collection <https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab>`_.

petab/lint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def is_scalar_float(x: Any):
530530
"""
531531
Checks whether input is a number or can be transformed into a number
532532
via float
533+
533534
:param x:
534535
input
535536
:return:

petab/observables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Functions for working with the PEtab observables table"""
22

3-
from _collections import OrderedDict
3+
from collections import OrderedDict
44
from typing import Union, List
55

66
import libsbml

petab/sbml.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,11 @@ def get_model_parameters(sbml_model: libsbml.Model, with_values=False
380380
381381
Arguments:
382382
sbml_model: SBML model
383-
with_values: If false, returns list of SBML model parameter IDs which
384-
are not AssignmentRule targets for observables or sigmas. If true,
385-
returns a dictionary with those parameter IDs as keys and parameter
386-
values from the SBML model as values.
383+
with_values:
384+
If False, returns list of SBML model parameter IDs which
385+
are not AssignmentRule targets for observables or sigmas. If True,
386+
returns a dictionary with those parameter IDs as keys and parameter
387+
values from the SBML model as values.
387388
"""
388389
if not with_values:
389390
return [p.getId() for p in sbml_model.getListOfParameters()

setup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ def absolute_links(txt):
6969
tests_require=['flake8', 'pytest', 'python-libcombine'],
7070
python_requires='>=3.7.1',
7171
entry_points=ENTRY_POINTS,
72-
extras_require={'reports': ['Jinja2'],
73-
'combine': ['python-libcombine>=0.2.6']},
72+
extras_require={
73+
'reports': ['Jinja2'],
74+
'combine': ['python-libcombine>=0.2.6'],
75+
'doc': [
76+
'sphinx>=3.5.3',
77+
'sphinxcontrib-napoleon>=0.7',
78+
'sphinx-markdown-tables>=0.0.15',
79+
'sphinx-rtd-theme>=0.5.1',
80+
'recommonmark>=0.7.1',
81+
'nbsphinx>=0.8.2',
82+
'm2r>=0.2.1',
83+
'ipython>=7.21.0',
84+
]
85+
}
7486
)

0 commit comments

Comments
 (0)