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

ENH: command line interface #55

Merged
merged 11 commits into from
Dec 10, 2019
Merged

ENH: command line interface #55

merged 11 commits into from
Dec 10, 2019

Conversation

mgxd
Copy link
Member

@mgxd mgxd commented Dec 3, 2019

Closes #48

Adds nt executable for command line usage of nitransforms.

Currently only supports nt apply, which applies a linear or nonlinear transform to an image.

@codecov-io
Copy link

codecov-io commented Dec 3, 2019

Codecov Report

Merging #55 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
+ Coverage   98.77%   98.84%   +0.06%     
==========================================
  Files          10       11       +1     
  Lines         819      868      +49     
  Branches      107      111       +4     
==========================================
+ Hits          809      858      +49     
  Misses          6        6              
  Partials        4        4
Flag Coverage Δ
#unittests 98.84% <100%> (+0.06%) ⬆️
Impacted Files Coverage Δ
nitransforms/base.py 99.4% <ø> (ø) ⬆️
nitransforms/cli.py 100% <100%> (ø)

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 76f525e...5835a97. Read the comment docs.

Copy link
Collaborator

@oesteban oesteban left a comment

Choose a reason for hiding this comment

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

Looking good!

@@ -0,0 +1,122 @@
from argparse import ArgumentParser, RawDescriptionHelpFormatter
Copy link
Collaborator

Choose a reason for hiding this comment

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

click is pretty lightweight - @effigies do you think would be some resistance in nibabel to migrate nib-ls and other command line scripts I might not be aware of?

Copy link
Member

Choose a reason for hiding this comment

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

In general, nibabel has tried to avoid mandatory dependencies besides numpy. You might get some pushback on click, but might not, given it doesn't have any dependencies of its own.

Copy link
Member Author

Choose a reason for hiding this comment

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

i've made the main() allow supplemental args to be passed in to argparse.ArgumentParser.parse_args() - hopefully that is sufficient for testing purposes

nitransforms/cli.py Show resolved Hide resolved
nitransforms/cli.py Outdated Show resolved Hide resolved
nitransforms/cli.py Outdated Show resolved Hide resolved
nitransforms/cli.py Outdated Show resolved Hide resolved
nitransforms/cli.py Outdated Show resolved Hide resolved


def get_parser():
desc = dedent("""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does not argparse compose a good description for commands?

Copy link
Member Author

Choose a reason for hiding this comment

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

i find it's nice to have a little blurb describing the subparsers at the top level (argparse doesn't do this)

@pep8speaks
Copy link

pep8speaks commented Dec 9, 2019

Hello @mgxd! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-12-09 22:50:22 UTC

@mgxd mgxd merged commit 81e7a67 into nipy:master Dec 10, 2019
@mgxd mgxd deleted the enh/cli branch December 10, 2019 00:56
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.

Command line utility
5 participants