Skip to content

Commit 5b3d0f8

Browse files
committed
docs: update conf.py
1 parent 4f23fbe commit 5b3d0f8

File tree

3 files changed

+20
-38
lines changed

3 files changed

+20
-38
lines changed

docs/conf.py

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,35 @@
55
import os
66
import sys
77

8+
try:
9+
from importlib import metadata
10+
except ImportError:
11+
import importlib_metadata as metadata
12+
813
# path to autogen'ed modules
914
sys.path.append(os.path.abspath('..'))
10-
11-
# mock out some extension modules
12-
class Mock:
13-
def __init__(self, *args, **kwargs):
14-
pass
15-
16-
def __call__(self, *args, **kwargs):
17-
return Mock()
18-
19-
@classmethod
20-
def __getattr__(self, name):
21-
if name in ('__file__', '__path__'):
22-
return '/dev/null'
23-
elif name[0] == name[0].upper():
24-
return type(name, (), {})
25-
else:
26-
return Mock()
27-
28-
for mod_name in [ 'sympy', 'numpy', 'pyweno.codeprinters', 'pyweno.ccoeffs', 'pyweno.cweno' ]:
29-
sys.modules[mod_name] = Mock()
15+
m = metadata.metadata('PyWENO')
3016

3117
# extentions
32-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.mathjax']
18+
extensions = [
19+
'sphinx.ext.autodoc',
20+
'sphinx.ext.mathjax',
21+
]
3322

3423
# general configuration
3524
source_suffix = '.rst'
3625
master_doc = 'index'
3726

3827
# html configuration
3928
pygments_style = 'sphinx'
40-
html_theme = 'default'
29+
html_theme = 'sphinx_rtd_theme'
4130

4231
html_sidebars = {
4332
'**': ['globaltoc.html', 'searchbox.html'],
4433
}
4534

4635
# project information
47-
project = 'PyWENO'
48-
copyright = '2009, 2010, 2011, Matthew Emmett'
49-
50-
with open('../version.py') as f:
51-
exec(f.read()) # this sets 'version'
52-
release = version
36+
project = m['Name']
37+
author = m['Author-email']
38+
copyright = f'2009, 2010, 2011 {author}'
39+
release = m['Version']

docs/reference.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,3 @@ Non-uniform reconstructions
4646

4747
.. automodule:: pyweno.nonuniform
4848
:members:
49-
50-
51-
Version
52-
-------
53-
54-
.. automodule:: pyweno.version

docs/tutorial.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ The code to generate the above is in
4747
Version information
4848
-------------------
4949

50-
Here we obtain the version of PyWENO::
50+
PyWENO uses standard Python packaging, so its version information can be obtained
51+
through ``importlib``. However, you can also get it from the module itself::
5152

52-
>>> import pyweno.version
53-
>>> pyweno.version.version()
54-
>>> pyweno.version.git_version()
53+
>>> from pyweno import __version__
54+
>>> __version__
55+
'0.11.2'
5556

5657

5758

0 commit comments

Comments
 (0)