Skip to content

Commit

Permalink
DX: colorize sphinx-build output (#190)
Browse files Browse the repository at this point in the history
* DX: pass all environment variables in `tox` config

* MAINT: ignore linkcheck problem onlinelibrary.wiley.com
  https://github.com/ComPWA/compwa-org/actions/runs/4356192647/jobs/7613864161#step:5:365

* MAINT: remove quotations from environment values

* MAINT: sort config keys in `tox.ini`

* MAINT: update `black` formatting

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
redeboer and pre-commit-ci[bot] authored Mar 7, 2023
1 parent cc673ff commit 1f9c356
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 57 deletions.
4 changes: 2 additions & 2 deletions docs/adr/001/operators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@
" return self.opn(self.op1.eval())\n",
"\n",
"\n",
"asMagicNumber = (\n",
" lambda x: x if isinstance(x, MagicNumber) else Constant(x) # noqa: E731\n",
"asMagicNumber = lambda x: ( # noqa: E731\n",
" x if isinstance(x, MagicNumber) else Constant(x)\n",
")\n",
"asMagicNumber(2).eval()"
]
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def get_minor_version(package_name: str) -> str:
linkcheck_ignore = [
"http://127.0.0.1:8000",
"https://atom.io", # often instable
"https://doi.org/10.1002/andp.19955070504", # 403 for onlinelibrary.wiley.com
"https://github.com/organizations/ComPWA/settings/repository-defaults", # private
"https://github.com/orgs/ComPWA/projects/5", # private
"https://github.com/orgs/ComPWA/projects/6", # private
Expand Down
16 changes: 9 additions & 7 deletions docs/report/017.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,15 @@
" T1: T0 / 3 - r * sp.cos(theta),\n",
" T2: T0 / 3 - r * sp.cos(theta + 2 * sp.pi / 3),\n",
" T3: T0 / 3 - r * sp.cos(theta + 4 * sp.pi / 3),\n",
" T0: m0**2\n",
" + m1**2\n",
" + m2**2\n",
" + m3**2\n",
" - (m2 + m3) ** 2\n",
" - (m1 + m3) ** 2\n",
" - (m1 + m2) ** 2,\n",
" T0: (\n",
" m0**2\n",
" + m1**2\n",
" + m2**2\n",
" + m3**2\n",
" - (m2 + m3) ** 2\n",
" - (m1 + m3) ** 2\n",
" - (m1 + m2) ** 2\n",
" ),\n",
"}"
]
},
Expand Down
5 changes: 3 additions & 2 deletions docs/report/020.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,9 @@
"outputs": [],
"source": [
"initial_parameters = {\n",
" R\"C_{J/\\psi(1S) \\to {f_{0}(1500)}_{0} \\gamma_{+1}; f_{0}(1500) \\to \\pi^{0}_{0} \\pi^{0}_{0}}\": 1.0\n",
" + 0.0j,\n",
" R\"C_{J/\\psi(1S) \\to {f_{0}(1500)}_{0} \\gamma_{+1}; f_{0}(1500) \\to \\pi^{0}_{0} \\pi^{0}_{0}}\": (\n",
" 1.0 + 0.0j\n",
" ),\n",
" \"m_{f_{0}(500)}\": 0.4,\n",
" \"m_{f_{0}(980)}\": 0.88,\n",
" \"m_{f_{0}(1370)}\": 1.22,\n",
Expand Down
82 changes: 36 additions & 46 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,29 @@
envlist =
doc,
sty,
passenv = PYTHONPATH
skip_install = True
skip_missing_interpreters = True
skipsdist = True

[testenv:doc]
description =
Build documentation and API through Sphinx
allowlist_externals =
sphinx-build
passenv =
EXECUTE_NB
GITHUB_REPO
GITHUB_TOKEN
READTHEDOCS_VERSION
commands =
sphinx-build \
--color \
--keep-going \
-TW \
-b html \
docs/ docs/_build/html
description =
Build documentation and API through Sphinx
passenv = *
setenv =
FORCE_COLOR = yes

[testenv:doclive]
description =
Set up a server to directly preview changes to the HTML pages
allowlist_externals =
sphinx-autobuild
passenv =
EXECUTE_NB
GITHUB_REPO
GITHUB_TOKEN
READTHEDOCS_VERSION
TERM
commands =
sphinx-autobuild \
--open-browser \
Expand All @@ -55,16 +44,13 @@ commands =
--re-ignore docs/_build/.* \
--watch docs \
docs/ docs/_build/html

[testenv:docnb]
description =
Build documentation through Sphinx WITH output of Jupyter notebooks
passenv =
GITHUB_REPO
GITHUB_TOKEN
READTHEDOCS_VERSION
Set up a server to directly preview changes to the HTML pages
passenv = *
setenv =
EXECUTE_NB = "yes"
FORCE_COLOR = yes

[testenv:docnb]
allowlist_externals =
sphinx-build
commands =
Expand All @@ -74,36 +60,36 @@ commands =
-TW \
-b html \
docs/ docs/_build/html
description =
Build documentation through Sphinx WITH output of Jupyter notebooks
passenv = *
setenv =
EXECUTE_NB = yes
FORCE_COLOR = yes

[testenv:docnb-force]
description =
Execute ALL Jupyter notebooks and build documentation with Sphinx
allowlist_externals =
sphinx-build
passenv =
READTHEDOCS_VERSION
TERM
commands =
sphinx-build -nW --keep-going -b html docs/ docs/_build/html
description =
Execute ALL Jupyter notebooks and build documentation with Sphinx
passenv = *
setenv =
FORCE_COLOR = yes
FORCE_EXECUTE_NB = yes
PYTHONHASHSEED = 0
commands =
sphinx-build -nW --keep-going -b html docs/ docs/_build/html

[testenv:jcache]
description =
Inspect Jupyter cache
allowlist_externals =
jcache
changedir = docs/_build
commands =
jcache {posargs:notebook list}
description =
Inspect Jupyter cache

[testenv:linkcheck]
description =
Check external links in the documentation (requires internet connection)
passenv =
EXECUTE_NB
READTHEDOCS_VERSION
allowlist_externals =
sphinx-build
commands =
Expand All @@ -112,23 +98,27 @@ commands =
-T \
-b linkcheck \
docs/ docs/_build/linkcheck
description =
Check external links in the documentation (requires internet connection)
passenv = *
setenv =
FORCE_COLOR = yes

[testenv:nb]
description =
Run all notebooks with pytest
allowlist_externals =
pytest
passenv =
EXECUTE_NB
commands =
pytest --nbmake {posargs:docs}
description =
Run all notebooks with pytest
passenv = *

[testenv:sty]
description =
Perform all linting, formatting, and spelling checks
allowlist_externals =
pre-commit
setenv =
SKIP = pyright
commands =
pre-commit run {posargs} -a
description =
Perform all linting, formatting, and spelling checks
setenv =
SKIP = pyright

0 comments on commit 1f9c356

Please sign in to comment.