From 8c501e3c00f41e6e77f8f7219c945914386af387 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 9 Aug 2022 13:52:37 +0200 Subject: [PATCH 1/2] fix: insert parity prefactor as `sympy.Rational` --- src/ampform/helicity/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ampform/helicity/__init__.py b/src/ampform/helicity/__init__.py index 398e77cd4..642524e3d 100644 --- a/src/ampform/helicity/__init__.py +++ b/src/ampform/helicity/__init__.py @@ -540,7 +540,7 @@ def __generate_helicity_coupling( def __generate_amplitude_prefactor( self, transition: StateTransition - ) -> float | None: + ) -> sp.Rational | None: prefactor = get_prefactor(transition) if prefactor != 1.0: for node_id in transition.topology.nodes: @@ -552,7 +552,7 @@ def __generate_amplitude_prefactor( raw_suffix ] if coefficient_suffix != raw_suffix: - return prefactor + return sp.Rational(prefactor) return None From bbe51f90aa371d28da5fa087605ce03e7fe1b7f3 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 9 Aug 2022 13:52:38 +0200 Subject: [PATCH 2/2] ci: add doc `tox` job that always executes all notebooks --- docs/conf.py | 19 ++++++++++++------- tox.ini | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 34966c2d0..c82f0849b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -338,16 +338,21 @@ def get_minor_version(package_name: str) -> str: "https://suchung.web.cern.ch", ] + # Settings for myst_nb +def get_execution_mode() -> str: + if "FORCE_EXECUTE_NB" in os.environ: + print("\033[93;1mWill run ALL Jupyter notebooks!\033[0m") + return "force" + if "EXECUTE_NB" in os.environ: + return "cache" + return "off" + + +nb_execution_mode = get_execution_mode() nb_execution_timeout = -1 nb_output_stderr = "remove" - -nb_execution_mode = "off" -EXECUTE_NB = False -if "EXECUTE_NB" in os.environ: - print("\033[93;1mWill run Jupyter notebooks!\033[0m") - EXECUTE_NB = True - nb_execution_mode = "cache" +EXECUTE_NB = nb_execution_mode != "off" # Settings for myst-parser myst_enable_extensions = [ diff --git a/tox.ini b/tox.ini index db350826b..330bed006 100644 --- a/tox.ini +++ b/tox.ini @@ -100,6 +100,20 @@ commands = -b html \ docs/ docs/_build/html +[testenv:docnb-force] +description = + Execute ALL Jupyter notebooks and build documentation with Sphinx +allowlist_externals = + sphinx-build +passenv = + READTHEDOCS_VERSION + TERM +setenv = + FORCE_EXECUTE_NB = yes + PYTHONHASHSEED = 0 +commands = + sphinx-build -nW --keep-going -b html docs/ docs/_build/html + [testenv:jcache] description = Inspect Jupyter cache