Skip to content

Commit

Permalink
tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Sep 2, 2024
1 parent 2f5e39c commit a243e46
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"sphinx.ext.napoleon",
"sphinxcontrib.bibtex",
"sphinx_autodoc_typehints",
"sphinx_tabs.tabs",
"sphinx.ext.mathjax",
"IPython.sphinxext.ipython_console_highlighting",
"sphinxext.opengraph",
Expand Down
43 changes: 43 additions & 0 deletions {{cookiecutter.project_name}}/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,31 @@ If not, please refer to the [scanpy developer guide][].

In addition to the packages needed to _use_ this package,
you need additional python packages to [run tests](#writing-tests) and [build the documentation](#docs-building).

:::::{tabs}
::::{group-tab} Hatch
The easiest way is to get familiar with [hatch environments][], with which these tasks are simply:

```bash
hatch test # defined in the table [tool.hatch.envs.hatch-test] in pyproject.toml
hatch run docs:build # defined in the table [tool.hatch.envs.docs]
```

::::

::::{group-tab} Pip
If you prefer managing environments manually, you can use `pip`:

```bash
cd {{ cookiecutter.project_name }}
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,test,doc]"
```

::::
:::::

[hatch environments]: https://hatch.pypa.io/latest/tutorials/environment/basic-usage/

## Code-style
Expand Down Expand Up @@ -84,12 +95,27 @@ hatch env find hatch-test # list all possible test environment paths

Alternatively, you can run all tests from the command line by executing

:::::{tabs}
::::{group-tab} Hatch

```bash
hatch test # test with the highest supported Python version
# or
hatch test --all # test with all supported Python versions
```

::::

::::{group-tab} Pip

```bash
source .venv/bin/activate
pytest
```

::::
:::::

in the root of the repository.

[pytest]: https://docs.pytest.org/
Expand Down Expand Up @@ -169,7 +195,24 @@ please check out [this feature request][issue-render-notebooks] in the `cookiecu

#### Building the docs locally

:::::{tabs}
::::{group-tab} Hatch

```bash
hatch docs:build
hatch docs:open
```

::::

::::{group-tab} Pip

```bash
source .venv/bin/activate
cd docs
make html
(xdg-)open _build/html/index.html
```

::::
:::::
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ optional-dependencies.doc = [
"sphinx-autodoc-typehints",
"sphinx-book-theme>=1",
"sphinx-copybutton",
"sphinx-tabs",
"sphinxcontrib-bibtex>=1",
"sphinxext-opengraph",
]
Expand Down

0 comments on commit a243e46

Please sign in to comment.