| |
| |
| |
| |
| |
|
|
| |
|
|
| |
| |
| |
| |
| import os |
| import sys |
| import importlib |
| import importlib.metadata |
| import inspect |
|
|
| sys.path.insert(0, os.path.abspath("..")) |
|
|
|
|
| |
|
|
| project = "varipeps" |
| copyright = "2021-2026, Jan Naumann, Philipp Schmoll, Roberto Losada, Frederik Wilde, Finn Krein" |
| author = "Jan Naumann, Philipp Schmoll, Roberto Losada, Frederik Wilde, Finn Krein" |
|
|
| |
| release = importlib.metadata.version("varipeps") |
|
|
|
|
| |
|
|
| |
| |
| |
| extensions = [ |
| "sphinx.ext.autodoc", |
| "sphinx.ext.autosummary", |
| "sphinx.ext.linkcode", |
| "sphinx.ext.mathjax", |
| "sphinx.ext.napoleon", |
| "sphinx.ext.intersphinx", |
| "sphinx_autodoc_defaultargs", |
| "sphinx_subfigure", |
| ] |
|
|
| napoleon_include_private_with_doc = True |
| napoleon_preprocess_types = False |
|
|
| autodoc_type_aliases = { |
| "T_PEPS_Unit_Cell": "PEPS_Unit_Cell", |
| "T_PEPS_Tensor": "PEPS_Tensor", |
| "PEPS_Unit_Cell.Unit_Cell_Data": "varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data", |
| "jax._src.numpy.lax_numpy.ndarray": "jax.numpy.ndarray", |
| "h5py._hl.group.Group": "h5py.Group", |
| } |
|
|
| |
|
|
| intersphinx_mapping = { |
| "python": ("https://docs.python.org/3", None), |
| "jax": ("https://jax.readthedocs.io/en/latest/", None), |
| "numpy": ("https://numpy.org/doc/stable/", None), |
| "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None), |
| "h5py": ("https://docs.h5py.org/en/stable/", None), |
| } |
|
|
| |
| templates_path = ["_templates"] |
|
|
| |
| |
| |
| exclude_patterns = [] |
|
|
| from varipeps import git_commit, git_tag |
|
|
| code_url = "https://github.com/variPEPS/variPEPS_Python/blob/{blob}" |
|
|
| if git_tag is not None: |
| code_url = code_url.format(blob=git_tag) |
| elif git_commit is not None: |
| code_url = code_url.format(blob=git_commit) |
| else: |
| code_url = code_url.format(blob=release) |
|
|
|
|
| def linkcode_resolve(domain, info): |
| |
| |
|
|
| if domain != "py": |
| return None |
| if not info["module"]: |
| return None |
|
|
| mod = importlib.import_module(info["module"]) |
| if "." in info["fullname"]: |
| objname_parts = info["fullname"].split(".") |
|
|
| obj = getattr(mod, objname_parts[0]) |
|
|
| for name in objname_parts[1:-1]: |
| obj = getattr(obj, name) |
|
|
| attrname = objname_parts[-1] |
|
|
| try: |
| |
| obj = getattr(obj, attrname) |
| except AttributeError: |
| |
| return None |
| else: |
| obj = getattr(mod, info["fullname"]) |
|
|
| try: |
| filename = inspect.getsourcefile(obj) |
| lines = inspect.getsourcelines(obj) |
| except (TypeError, OSError): |
| |
| return None |
|
|
| filename = os.path.relpath(filename, os.path.abspath("../..")) |
|
|
| if not filename.startswith("varipeps"): |
| |
| return None |
| start, end = lines[1], lines[1] + len(lines[0]) - 1 |
|
|
| return f"{code_url}/{filename}#L{start}-L{end}" |
|
|
|
|
| |
|
|
| |
| |
| |
| html_theme = "sphinx_rtd_theme" |
|
|
| |
| |
| |
| html_static_path = ["_static"] |
|
|
| html_logo = "images/logo.svg" |
| html_favicon = "images/favicon/favicon.svg" |
|
|
| html_theme_options = { |
| 'logo_only': True, |
| } |
|
|
| rst_prolog = """ |
| .. |default| raw:: html |
| |
| <div class="default-value-section"> <span class="default-value-label">Default:</span>""" |
|
|
| numfig = True |
|
|