| 1 |
import datetime |
| 2 |
import os |
| 3 |
import subprocess |
| 4 |
import sys |
| 5 |
|
| 6 |
import toml |
| 7 |
|
| 8 |
sys.path.insert(0, os.path.abspath('../src')) |
| 9 |
|
| 10 |
|
| 11 |
with open('../pyproject.toml') as f: |
| 12 |
metadata = toml.load(f)['tool']['poetry'] |
| 13 |
|
| 14 |
project = 'libMBD' |
| 15 |
release = version = ( |
| 16 |
subprocess.run(['poetry', 'version'], capture_output=True, cwd='..') |
| 17 |
.stdout.decode() |
| 18 |
.split()[1] |
| 19 |
) |
| 20 |
author = ' '.join(metadata['authors'][0].split()[:-1]) |
| 21 |
description = metadata['description'] |
| 22 |
|
| 23 |
extensions = [ |
| 24 |
'sphinx.ext.autodoc', |
| 25 |
'sphinx.ext.todo', |
| 26 |
'sphinx.ext.mathjax', |
| 27 |
'sphinx.ext.viewcode', |
| 28 |
] |
| 29 |
source_suffix = '.rst' |
| 30 |
master_doc = 'index' |
| 31 |
copyright = f'2018-{datetime.date.today().year}, {author}' |
| 32 |
language = 'en' |
| 33 |
exclude_patterns = ['build', '.DS_Store'] |
| 34 |
pygments_style = 'sphinx' |
| 35 |
todo_include_todos = True |
| 36 |
html_theme = 'alabaster' |
| 37 |
html_static_path = ['_static'] |
| 38 |
html_favicon = '_static/favicon-32.png' |
| 39 |
html_theme_options = { |
| 40 |
'description': description, |
| 41 |
'logo': 'libmbd-lockup.svg', |
| 42 |
'logo_name': False, |
| 43 |
'github_button': True, |
| 44 |
'github_user': 'libmbd', |
| 45 |
'github_repo': 'libmbd', |
| 46 |
} |
| 47 |
html_sidebars = { |
| 48 |
'**': ['about.html', 'navigation.html', 'relations.html', 'searchbox.html'] |
| 49 |
} |
| 50 |
|
| 51 |
autodoc_default_options = {'members': True} |
| 52 |
autodoc_inherit_docstrings = False |
| 53 |
autodoc_mock_imports = [ |
| 54 |
'numpy', |
| 55 |
'scipy', |
| 56 |
'pymbd._libmbd', |
| 57 |
'mpi4py', |
| 58 |
] |
| 59 |
|
| 60 |
|
| 61 |
def skip_namedtuples(app, what, name, obj, skip, options): |
| 62 |
if hasattr(obj, '_source'): |
| 63 |
return True |
| 64 |
|
| 65 |
|
| 66 |
def setup(app): |
| 67 |
app.connect('autodoc-skip-member', skip_namedtuples) |