Skip to content

Commit 4bd2632

Browse files
authored
DOC: improve documentation (#106)
* add CLI modules documentation * rename group in click CLIs to reduce confusion * switch to RST for CLI modules docs, since MD support appears to be incomplete/buggy in click-sphinx * update documentation in few places
1 parent 8f7743e commit 4bd2632

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

docs/api/idc_index.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
idc\_index package
2-
==================
1+
idc\_index package API
2+
=======================
33

44
.. automodule:: idc_index
55
:members:
@@ -16,3 +16,11 @@ idc\_index.index module
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:
19+
20+
idc\_index.cli module
21+
-----------------------
22+
23+
.. automodule:: idc_index.cli
24+
:members:
25+
:undoc-members:
26+
:show-inheritance:

docs/cli_tools.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Command Line Interface tools
2+
============================
3+
4+
*idc-index* provides a command line interface (CLI) tool to simplify access to the functionality
5+
implemented via the Python API. The CLI tool is a wrapper around the Python API and provides a
6+
simple way to interact with the package.
7+
8+
Once *idc-index* is installed, the CLI tool can be accessed by running the following command in the
9+
terminal.
10+
11+
.. click:: idc_index.cli:idc
12+
:prog: idc
13+
:nested: full

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"sphinx.ext.napoleon",
1616
"sphinx_autodoc_typehints",
1717
"sphinx_copybutton",
18+
"sphinx_click",
1819
]
1920

2021
source_suffix = [".rst", ".md"]

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ starting a discussion in [IDC User forum](https://discourse.canceridc.dev/).
2929
:caption: API docs
3030
3131
column_descriptions
32+
cli_tools.rst
3233
api/idc_index
3334
```
3435

idc_index/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020

2121
@click.group()
22-
def main():
23-
"""Idc is a command line client to help download data from Imaging Data Commons."""
22+
def idc():
23+
"""`idc` is a command line interface to the API functionality available in idc-index."""
2424

2525

2626
def set_log_level(log_level):
@@ -42,7 +42,7 @@ def set_log_level(log_level):
4242
logger_cli.setLevel(logging_level)
4343

4444

45-
@main.command()
45+
@idc.command()
4646
@click.option(
4747
"--download-dir",
4848
required=True,
@@ -199,7 +199,7 @@ def download_from_selection(
199199
)
200200

201201

202-
@main.command()
202+
@idc.command()
203203
@click.option(
204204
"--manifest-file",
205205
required=True,
@@ -291,7 +291,7 @@ def download_from_manifest(
291291
)
292292

293293

294-
@main.command()
294+
@idc.command()
295295
@click.argument(
296296
"generic_argument",
297297
type=str,
@@ -371,4 +371,4 @@ def check_and_download(column_name, item_ids, download_dir, kwarg_name):
371371

372372

373373
if __name__ == "__main__":
374-
main()
374+
idc()

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ dependencies = [
4242
"pyarrow",
4343
"requests",
4444
"s5cmd",
45+
"sphinx-click",
4546
"tqdm"
4647
]
4748

@@ -63,7 +64,7 @@ docs = [
6364
]
6465

6566
[project.scripts]
66-
idc = 'idc_index.cli:main'
67+
idc = 'idc_index.cli:idc'
6768

6869
[project.urls]
6970
Homepage = "https://github.com/ImagingDataCommons/idc-index"

0 commit comments

Comments
 (0)