Skip to content

help info for parameters appears in cli for upload and download#146

Merged
Bento007 merged 11 commits intomasterfrom
tsmith-cli-doc
Aug 8, 2018
Merged

help info for parameters appears in cli for upload and download#146
Bento007 merged 11 commits intomasterfrom
tsmith-cli-doc

Conversation

@Bento007
Copy link
Copy Markdown
Collaborator

@Bento007 Bento007 commented Jul 31, 2018

Release Notes

  • Using sphinx-argparser to generate documentation for the CLI into cli.rst
  • refactored docstrings to restructed text format
  • TOC now populates in sphinx documentation
  • added common links to epilog in sphinx documentation
  • using sphinx RSTParser to parse docstrings into argparser
  • spread out documentation across api.rst, readme.rst, cli.rst, and index.rst

Known Issue

  • the sphinx documentation incorrectly marks all commands generated from a swagger doc as a classmethod.

@Bento007 Bento007 self-assigned this Jul 31, 2018
@Bento007 Bento007 requested a review from kislyuk July 31, 2018 02:37
@Bento007 Bento007 requested a review from hannes-ucsc July 31, 2018 02:42
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 31, 2018

Codecov Report

Merging #146 into master will increase coverage by 0.61%.
The diff coverage is 97.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #146      +/-   ##
==========================================
+ Coverage   86.75%   87.37%   +0.61%     
==========================================
  Files          33       33              
  Lines        1208     1291      +83     
==========================================
+ Hits         1048     1128      +80     
- Misses        160      163       +3
Impacted Files Coverage Δ
hca/upload/__init__.py 93.75% <ø> (ø) ⬆️
hca/cli.py 66.21% <100%> (+1.42%) ⬆️
hca/dss/__init__.py 83.64% <100%> (ø) ⬆️
hca/util/__init__.py 93.11% <100%> (+0.02%) ⬆️
hca/util/_docs.py 96.96% <96%> (-3.04%) ⬇️
hca/upload/upload_config.py 90.9% <0%> (-0.9%) ⬇️
hca/upload/upload_area.py 98.13% <0%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 694c5b9...722968a. Read the comment docs.

@Bento007 Bento007 force-pushed the tsmith-cli-doc branch 3 times, most recently from 6a04d6f to 9a1eb4c Compare August 1, 2018 22:56
Copy link
Copy Markdown
Contributor

@hannes-ucsc hannes-ucsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bento007 and I talked in person and agreed on some changes. Rejecting this purely for procedural reasons so I get notified for the next round of reviews.

Copy link
Copy Markdown
Contributor

@hannes-ucsc hannes-ucsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat.

Comment thread hca/util/__init__.py Outdated

@staticmethod
def parse_docstring(docstring):
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use triple single quotes here (despite that being a PEP8 violation), …

Comment thread hca/util/__init__.py Outdated
arguments. Any other text is combined and added to the argparse description.

example:
\"\"\"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can use triple double quotes here. Would look less odd.

Comment thread docs/index.rst
* :ref:`search`
readme
cli
api
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the index page only contain a table of contents. Please change this so that the introduction still appears on the index page.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added readme.rst to index.rst

Comment thread hca/dss/__init__.py Outdated
manifest is not set. If and only if a data file matches any of the patterns in `data_files` will it be
downloaded.
:param str bundle_uuid: The uuid of the bundle to download
:param str replica: the replica to download from. [aws,gcp,azure]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "azure" and spell out the possible values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed azure and specified what the replicas mean.

Comment thread hca/dss/__init__.py Outdated
downloaded.
:param str bundle_uuid: The uuid of the bundle to download
:param str replica: the replica to download from. [aws,gcp,azure]
:param str version: Timestamp of bundle creation in RFC3339. The version to download, else download the latest.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/else/If not specified/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread hca/dss/__init__.py Outdated
Each row in the manifest represents one file in DSS. The manifest must have a header row. The header row must
declare the following columns:
:param str manifest: path to a TSV (tab-separated values) file listing files to download
:param str replica: the replica to download from. [aws,gcp,azure]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread hca/dss/__init__.py Outdated
declare the following columns:
:param str manifest: path to a TSV (tab-separated values) file listing files to download
:param str replica: the replica to download from. [aws,gcp,azure]
:param int initial_retries_left: The initial number of times to retries a failed download.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/retries/retry

Also, what does "initial" mean here? It should really be "num_retries" or something else more intuitive.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added additional details to initial_retries_left

Comment thread hca/dss/__init__.py Outdated
Upload a directory of files from the local filesystem and create a bundle containing the uploaded files.

:param str src_dir: file path to a directory of file to upload
:param str replica: the replica to upload to. [aws,gcp,azure]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread hca/dss/__init__.py Outdated
:param str src_dir: file path to a directory of file to upload
:param str replica: the replica to upload to. [aws,gcp,azure]
:param str staging_bucket: the bucket to upload from.
:param int timeout_seconds: timeout.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout for what?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more details.

Comment thread hca/dss/__init__.py Outdated

:param str src_dir: file path to a directory of file to upload
:param str replica: the replica to upload to. [aws,gcp,azure]
:param str staging_bucket: the bucket to upload from.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bucket where?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more details.

Comment thread requirements-dev.txt
backports.tempfile
mock
unittest2
sphinx-argparse
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements-dev is for test/development-only requirements, but you are importing these packages in the main codebase. So you have to put this in requirements.txt, not requirements-dev.

Also, when I installed this, it didn't seem to automatically pull in sphinx, and I got an error:

>make docs
/Library/Developer/CommandLineTools/usr/bin/make -C docs html
Running Sphinx v1.5.5

Exception occurred:
  File "/Users/akislyuk/projects/dcp-cli/hca/util/__init__.py", line 100, in <module>
    from sphinx.parsers import RSTParser
ImportError: cannot import name RSTParser

I ran pip install sphinx and the error went away. Can you check if sphinx-argparse pulls in sphinx? If not, you have to list it here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added docutils to requirements.txt, added sphinx and sphinx-argparser to requirement-dev.txt

Comment thread hca/util/__init__.py Outdated
**self._get_command_arg_settings(param_data))

@staticmethod
def parse_docstring(docstring):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make package organization more consistent and uncrowd this file, please detach this method and move it to hca/util/_docs.py.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to hca/util/_docs.py

Trent Smith added 2 commits August 3, 2018 16:56
* moved docstrings for API to __init__ files.
* deleted readme.rst
* README.rst appears above table of contents in index.rst page.
* removed unused imports from docs/conf.py
* changed sphinx project name from 'hca-cli' to 'HCA CLI'
* change epilog format to look less confusing.
@Bento007 Bento007 requested a review from kislyuk August 6, 2018 16:14
Comment thread hca/dss/__init__.py Outdated
set. If and only if a metadata file matches any of the patterns in `metadata_files` will it be downloaded.
:param list data_files: one or more shell patterns against which all data files in the bundle will be matched
case-sensitively. A file is considered a data file if the `indexed` property in the manifest is not set. If
and only if a data file matches any of the patterns in `data_files` will it be downloaded.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: "The file will be downloaded only if ..."

Comment thread hca/dss/__init__.py Outdated
:param list data_files: one or more shell patterns against which all data files in the bundle will be matched
case-sensitively. A file is considered a data file if the `indexed` property in the manifest is not set. If
and only if a data file matches any of the patterns in `data_files` will it be downloaded.
:param int initial_retries_left: The initial quota of download failures to accept before exiting due to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter should be renamed to something like num_retries. "Initial" and "left" are implementation details.

"The number of times to attempt the download before exiting with an error"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants