Skip to content

Commit

Permalink
Freeze API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- committed Feb 27, 2025
1 parent 5ad0df1 commit 8b379e8
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ build
dist
.vscode
src/rhalphalib/version.py
docs/api
docs/_build
.nox
34 changes: 34 additions & 0 deletions docs/api/rhalphalib.plot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
rhalphalib.plot package
=======================

.. automodule:: rhalphalib.plot
:members:
:show-inheritance:
:undoc-members:

Submodules
----------

rhalphalib.plot.input\_shapes module
------------------------------------

.. automodule:: rhalphalib.plot.input_shapes
:members:
:show-inheritance:
:undoc-members:

rhalphalib.plot.plot\_TF module
-------------------------------

.. automodule:: rhalphalib.plot.plot_TF
:members:
:show-inheritance:
:undoc-members:

rhalphalib.plot.plot\_cov module
--------------------------------

.. automodule:: rhalphalib.plot.plot_cov
:members:
:show-inheritance:
:undoc-members:
26 changes: 26 additions & 0 deletions docs/api/rhalphalib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
rhalphalib package
==================

.. automodule:: rhalphalib
:members:
:show-inheritance:
:undoc-members:

Subpackages
-----------

.. toctree::
:maxdepth: 4

rhalphalib.plot

Submodules
----------

rhalphalib.util module
----------------------

.. automodule:: rhalphalib.util
:members:
:show-inheritance:
:undoc-members:
24 changes: 23 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
from __future__ import annotations

from functools import reduce
import importlib.metadata
import inspect
from typing import Any
import subprocess

project = "rhalphalib"
copyright = "2025, rhalphalib developers"
author = "Nick Smith"
version = release = importlib.metadata.version("rhalphalib")
githash = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode("ascii")

extensions = [
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.linkcode",
"sphinx_autodoc_typehints",
"sphinx_copybutton",
"nbsphinx",
Expand Down Expand Up @@ -45,7 +50,7 @@
},
],
"source_repository": "https://github.com/nsmith-/rhalphalib",
"source_branch": "main",
"source_branch": "master",
"source_directory": "docs/",
}

Expand All @@ -65,3 +70,20 @@
]

always_document_param_types = True


def linkcode_resolve(domain, info):
if domain != "py":
return None
if not info["module"]:
return None
mod = importlib.import_module(info["module"])
obj = reduce(getattr, [mod] + info["fullname"].split("."))
try:
path = inspect.getsourcefile(obj)
relpath = path[path.rfind("/src") + 1 :]
_, lineno = inspect.getsourcelines(obj)
except TypeError:
# skip property or other type that inspect doesn't like
return None
return "http://github.com/nsmith-/rhalphalib/blob/{}/{}#L{}".format(githash, relpath, lineno)
2 changes: 2 additions & 0 deletions src/rhalphalib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
NuisanceParameter,
IndependentParameter,
DependentParameter,
Parameter,
)
from .function import (
BasisPoly,
Expand All @@ -36,6 +37,7 @@
"NuisanceParameter",
"IndependentParameter",
"DependentParameter",
"Parameter",
"BasisPoly",
"BernsteinPoly",
"DecorrelatedNuisanceVector",
Expand Down
7 changes: 7 additions & 0 deletions src/rhalphalib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ def _pairwise_sum(array):


def install_roofit_helpers():
"""Install some nice pythonizations for RooFit
This is a one-time operation, so it is safe to call multiple times.
Some of these helpers are part of more recent ROOT releases, so
we check the version and only install them if they are not
already present.
"""
global ROOFIT_HELPERS_INSTALLED
if ROOFIT_HELPERS_INSTALLED:
return
Expand Down

0 comments on commit 8b379e8

Please sign in to comment.