Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: switch to sphinx-design #450

Merged
merged 5 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .constraints/py3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ identify==2.5.1
idna==3.3
imagesize==1.3.0
iminuit==2.12.0
importlib-metadata==4.2.0
importlib-metadata==4.2.0 ; python_version < "3.8.0"
importlib-resources==5.8.0
iniconfig==1.1.1
ipykernel==6.15.0
Expand Down Expand Up @@ -192,7 +192,7 @@ sphinx-book-theme==0.3.2
sphinx-codeautolink==0.11.0
sphinx-comments==0.0.3
sphinx-copybutton==0.5.0
sphinx-panels==0.6.0
sphinx-design==0.2.0
sphinx-thebe==0.1.2
sphinx-togglebutton==0.3.1
sphinxcontrib-applehelp==1.0.2
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ sphinx-book-theme==0.3.2
sphinx-codeautolink==0.11.0
sphinx-comments==0.0.3
sphinx-copybutton==0.5.0
sphinx-panels==0.6.0
sphinx-design==0.2.0
sphinx-thebe==0.1.2
sphinx-togglebutton==0.3.1
sphinxcontrib-applehelp==1.0.2
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ sphinx-book-theme==0.3.2
sphinx-codeautolink==0.11.0
sphinx-comments==0.0.3
sphinx-copybutton==0.5.0
sphinx-panels==0.6.0
sphinx-design==0.2.0
sphinx-thebe==0.1.2
sphinx-togglebutton==0.3.1
sphinxcontrib-applehelp==1.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.0.131
rev: 0.0.132
hooks:
- id: check-dev-files
args:
Expand Down
19 changes: 13 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
import sys

import requests
from pkg_resources import get_distribution

if sys.version_info < (3, 8):
from importlib_metadata import PackageNotFoundError
from importlib_metadata import version as get_package_version
else:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as get_package_version

# -- Project information -----------------------------------------------------
project = "TensorWaves"
Expand All @@ -27,9 +33,11 @@
if re.match(r"^\d+$", BRANCH): # PR preview
BRANCH = "stable"

if os.path.exists(f"../src/{PACKAGE}/version.py"):
__RELEASE = get_distribution(PACKAGE).version
version = ".".join(__RELEASE.split(".")[:3])
try:
__VERSION = get_package_version(PACKAGE)
version = ".".join(__VERSION.split(".")[:3])
except PackageNotFoundError:
pass


# -- Fetch logo --------------------------------------------------------------
Expand Down Expand Up @@ -105,7 +113,7 @@ def fetch_logo(url: str, output_path: str) -> None:
"sphinx_codeautolink",
"sphinx_comments",
"sphinx_copybutton",
"sphinx_panels",
"sphinx_design",
"sphinx_thebe",
"sphinx_togglebutton",
]
Expand Down Expand Up @@ -165,7 +173,6 @@ def fetch_logo(url: str, output_path: str) -> None:
"show_toc_level": 2,
}
html_title = "TensorWaves"
panels_add_bootstrap_css = False # wider page width with sphinx-panels
pygments_style = "sphinx"
todo_include_todos = False
viewcode_follow_imported_members = True
Expand Down
34 changes: 23 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,36 @@ The package is developed in parallel with {doc}`AmpForm <ampform:index>`, which
implements physics models for amplitude analysis, but its mechanisms for creating
computational backend functions can in principle be used independently.

:::{panels}

```{link-button} usage
:type: ref
:text: General examples
:classes: btn-outline-primary btn-block
<!-- prettier-ignore -->
::::{grid} 1 2 2 2
:gutter: 2

:::{grid-item}

```{button-ref} usage
:ref-type: doc
:color: primary
:expand:
:outline:
:shadow:
```

---
:::

```{link-button} amplitude-analysis
:type: ref
:text: Amplitude analysis
:classes: btn-outline-primary btn-block
:::{grid-item}

```{button-ref} amplitude-analysis
:ref-type: doc
:color: primary
:expand:
:outline:
:shadow:
```

:::

::::

```{rubric} Table of contents

```
Expand Down
16 changes: 12 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ install that as in the install examples here.

:::

:::{tabbed} PyPI
::::{tab-set}

:::{tab-item} PyPI

```shell
python3 -m pip install tensorwaves[jax]
Expand All @@ -32,7 +34,7 @@ python3 -m pip install tensorwaves[jax,pwa]

:::

:::{tabbed} Conda
:::{tab-item} Conda

```shell
conda install -c conda-forge tensorwaves jax jaxlib
Expand All @@ -47,6 +49,8 @@ conda install -c conda-forge ampform phasespace

:::

::::

This installs the [latest release](https://github.com/ComPWA/tensorwaves/releases) that
you can find on the [`stable`](https://github.com/ComPWA/tensorwaves/tree/stable)
branch.
Expand Down Expand Up @@ -170,7 +174,9 @@ Next, you install the project in editable mode with either
[Conda](https://docs.conda.io) or [`pip`](https://pypi.org/project/pip). It's
recommended to use Conda, because this also pins the version of Python.

:::{tabbed} Conda
::::{tab-set}

:::{tab-item} Conda

```shell
conda env create
Expand All @@ -181,7 +187,7 @@ This installs the project in a Conda environment following the definitions in

:::

:::{tabbed} PyPI
:::{tab-item} PyPI

1. **[Recommended]** Create a virtual environment with
[`venv`](https://docs.python.org/3/library/venv.html) (see
Expand All @@ -199,6 +205,8 @@ This installs the project in a Conda environment following the definitions in

:::

::::

See {ref}`compwa-org:develop:Updating` for how to update the dependencies when new
commits come in.

Expand Down
14 changes: 8 additions & 6 deletions docs/usage/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -883,29 +883,31 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"````{tabbed} Terminal\n",
"::::{tab-set}\n",
":::{tab-item} Terminal\n",
"```bash\n",
"tensorboard --logdir logs\n",
"```\n",
"````\n",
":::\n",
"\n",
"````{tabbed} Python\n",
":::{tab-item} Python\n",
"```python\n",
"import tensorboard as tb\n",
"\n",
"tb.notebook.list() # View open TensorBoard instances\n",
"tb.notebook.start(args_string=\"--logdir logs\")\n",
"```\n",
"See more info [here](https://www.tensorflow.org/tensorboard/tensorboard_in_notebooks#tensorboard_in_notebooks)\n",
"````\n",
":::\n",
"\n",
"````{tabbed} Jupyter notebook\n",
":::{tab-item} Jupyter notebook\n",
"```ipython\n",
"%load_ext tensorboard\n",
"%tensorboard --logdir logs\n",
"```\n",
"See more info [here](https://www.tensorflow.org/tensorboard/tensorboard_in_notebooks#tensorboard_in_notebooks)\n",
"````"
":::\n",
"::::"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ all =
%(viz)s
doc =
%(all)s
importlib-metadata; python_version <"3.8.0"
ipympl
jupyter
matplotlib
Expand All @@ -95,7 +96,7 @@ doc =
sphinx-codeautolink[ipython]
sphinx-comments
sphinx-copybutton
sphinx-panels
sphinx-design
sphinx-thebe
sphinx-togglebutton
sphobjinv
Expand Down