|
3 | 3 | # For the full list of built-in configuration values, see the documentation: |
4 | 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
5 | 5 |
|
| 6 | +# Notebook preprocessing |
| 7 | +import glob |
| 8 | +import os |
| 9 | +import subprocess |
| 10 | + |
| 11 | +NOTEBOOK_DIR = os.path.join(os.path.dirname(__file__), "notebooks") |
| 12 | + |
| 13 | + |
| 14 | +def convert_py_to_ipynb(): |
| 15 | + py_files = glob.glob(os.path.join(NOTEBOOK_DIR, "*.py")) |
| 16 | + for py_file in py_files: |
| 17 | + ipynb_file = py_file.replace(".py", ".ipynb") |
| 18 | + subprocess.run( |
| 19 | + ["jupytext", "--to", "ipynb", "--output", ipynb_file, py_file], check=True |
| 20 | + ) |
| 21 | + subprocess.run( |
| 22 | + [ |
| 23 | + "jupyter", |
| 24 | + "nbconvert", |
| 25 | + "--to", |
| 26 | + "notebook", |
| 27 | + "--execute", |
| 28 | + "--inplace", |
| 29 | + ipynb_file, |
| 30 | + ], |
| 31 | + check=True, |
| 32 | + ) |
| 33 | + |
| 34 | + |
| 35 | +convert_py_to_ipynb() |
| 36 | + |
6 | 37 | # -- Project information ----------------------------------------------------- |
7 | 38 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
8 | 39 |
|
9 | | -project = 'tda-mapper' |
10 | | -copyright = '2024, Luca Simi' |
11 | | -author = 'Luca Simi' |
| 40 | +project = "tda-mapper" |
| 41 | +copyright = "2024, Luca Simi" |
| 42 | +author = "Luca Simi" |
12 | 43 |
|
13 | 44 | # -- General configuration --------------------------------------------------- |
14 | 45 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
15 | 46 |
|
16 | | -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx_rtd_theme', 'nbsphinx'] |
| 47 | +extensions = [ |
| 48 | + "sphinx.ext.autodoc", |
| 49 | + "sphinx.ext.viewcode", |
| 50 | + "sphinx_rtd_theme", |
| 51 | + "nbsphinx", |
| 52 | +] |
17 | 53 |
|
18 | | -templates_path = ['_templates'] |
| 54 | +templates_path = ["_templates"] |
19 | 55 | exclude_patterns = [] |
20 | 56 |
|
21 | 57 |
|
22 | 58 | # -- Options for HTML output ------------------------------------------------- |
23 | 59 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
24 | 60 |
|
25 | | -html_theme = 'sphinx_rtd_theme' |
26 | | -html_logo = 'logos/tda-mapper-logo-horizontal.png' |
| 61 | +html_theme = "sphinx_rtd_theme" |
| 62 | +html_logo = "logos/tda-mapper-logo-horizontal.png" |
27 | 63 | html_theme_options = { |
28 | | - 'sticky_navigation': True, |
29 | | - 'vcs_pageview_mode': 'blob', |
| 64 | + "sticky_navigation": True, |
| 65 | + "vcs_pageview_mode": "blob", |
30 | 66 | } |
31 | 67 | html_context = { |
32 | | - 'display_github': True, |
33 | | - 'github_user': 'lucasimi', |
34 | | - 'github_repo': 'tda-mapper-python', |
35 | | - 'github_version': 'main', |
36 | | - 'conf_py_path': '/docs/source/', |
| 68 | + "display_github": True, |
| 69 | + "github_user": "lucasimi", |
| 70 | + "github_repo": "tda-mapper-python", |
| 71 | + "github_version": "main", |
| 72 | + "conf_py_path": "/docs/source/", |
37 | 73 | } |
0 commit comments