bluemellophone commited on
Commit
2c117a2
·
unverified ·
1 Parent(s): 086ac52

Allow sphinx documentation of CLI and fix CLI command for example

Browse files
docs/cli.rst CHANGED
@@ -6,7 +6,6 @@ ScoutBot CLI
6
  :caption: Contents:
7
 
8
 
9
- .. automodule:: scoutbot.scoutbot
10
- :members:
11
- :undoc-members:
12
- :show-inheritance:
 
6
  :caption: Contents:
7
 
8
 
9
+ .. click:: scoutbot.scoutbot:cli
10
+ :prog: scoutbot
11
+ :nested: full
 
docs/conf.py CHANGED
@@ -37,6 +37,7 @@ extensions = [
37
  'sphinx.ext.viewcode',
38
  'sphinx.ext.imgmath',
39
  'sphinx.ext.napoleon',
 
40
  ]
41
 
42
  intersphinx_mapping = {
 
37
  'sphinx.ext.viewcode',
38
  'sphinx.ext.imgmath',
39
  'sphinx.ext.napoleon',
40
+ 'sphinx_click',
41
  ]
42
 
43
  intersphinx_mapping = {
requirements.optional.txt CHANGED
@@ -13,5 +13,6 @@ pytest-random-order
13
  pytest-sugar
14
  pytest-xdist
15
  Sphinx>=5,<6
 
16
  sphinx_rtd_theme
17
  xdoctest
 
13
  pytest-sugar
14
  pytest-xdist
15
  Sphinx>=5,<6
16
+ sphinx-click
17
  sphinx_rtd_theme
18
  xdoctest
scoutbot/__init__.py CHANGED
@@ -44,6 +44,11 @@ how the entire pipeline can be run on tiles or images, respectively.
44
  nms_thresh=agg_nms_thresh,
45
  )
46
  '''
 
 
 
 
 
47
  from scoutbot import utils
48
 
49
  log = utils.init_logging()
@@ -139,3 +144,23 @@ def pipeline(
139
  )
140
 
141
  return detects
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  nms_thresh=agg_nms_thresh,
45
  )
46
  '''
47
+ from os.path import exists
48
+
49
+ import pooch
50
+ import utool as ut
51
+
52
  from scoutbot import utils
53
 
54
  log = utils.init_logging()
 
144
  )
145
 
146
  return detects
147
+
148
+
149
+ def example():
150
+ TEST_IMAGE = 'scout.example.jpg'
151
+ TEST_IMAGE_HASH = (
152
+ '786a940b062a90961f409539292f09144c3dbdbc6b6faa64c3e764d63d55c988' # NOQA
153
+ )
154
+
155
+ img_filepath = pooch.retrieve(
156
+ url=f'https://wildbookiarepository.azureedge.net/data/{TEST_IMAGE}',
157
+ known_hash=TEST_IMAGE_HASH,
158
+ progressbar=True,
159
+ )
160
+ assert exists(img_filepath)
161
+
162
+ log.info(f'Running pipeline on image: {img_filepath}')
163
+
164
+ detects = pipeline(img_filepath)
165
+
166
+ log.info(ut.repr3(detects))
scoutbot/scoutbot.py CHANGED
@@ -7,7 +7,6 @@ import json
7
  from os.path import exists
8
 
9
  import click
10
- import pooch
11
  import utool as ut
12
 
13
  import scoutbot
@@ -106,23 +105,7 @@ def example():
106
  """
107
  Run a test of the pipeline on an example image
108
  """
109
- TEST_IMAGE = 'scout.example.jpg'
110
- TEST_IMAGE_HASH = (
111
- '786a940b062a90961f409539292f09144c3dbdbc6b6faa64c3e764d63d55c988' # NOQA
112
- )
113
-
114
- img_filepath = pooch.retrieve(
115
- url=f'https://wildbookiarepository.azureedge.net/data/{TEST_IMAGE}',
116
- known_hash=TEST_IMAGE_HASH,
117
- progressbar=True,
118
- )
119
- assert exists(img_filepath)
120
-
121
- log.info(f'Running pipeline on image: {img_filepath}')
122
-
123
- detects = scoutbot.pipeline(img_filepath)
124
-
125
- log.info(ut.repr3(detects))
126
 
127
 
128
  @click.group()
 
7
  from os.path import exists
8
 
9
  import click
 
10
  import utool as ut
11
 
12
  import scoutbot
 
105
  """
106
  Run a test of the pipeline on an example image
107
  """
108
+ scoutbot.example()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
 
111
  @click.group()