thoth-station / jupyterlab-requirements

JupyterLab Extension for dependency management and optimization
GNU General Public License v3.0
16 stars 9 forks source link

[2pt] SystemExit error when running `%horus --help` #632

Closed mayaCostantini closed 2 years ago

mayaCostantini commented 2 years ago

Describe the bug

When running %horus --help in a new notebook on Operate First (smaug), the following error occurs:

---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
/tmp/ipykernel_179/1392557305.py in <module>
----> 1 get_ipython().run_line_magic('horus', '--help')

/opt/app-root/lib64/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2362                 kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2363             with self.builtin_trap:
-> 2364                 result = fn(*args, **kwargs)
   2365             return result
   2366 

/opt/app-root/lib64/python3.8/site-packages/decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

/opt/app-root/lib64/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/opt/app-root/lib64/python3.8/site-packages/jupyterlab_requirements/dependency_management/magic_commands.py in horus(self, line)
    219         ## Parse inputs
    220         opts = line.split()
--> 221         args = parser.parse_args(opts)
    222 
    223         if any([opt in {"-h", "--help"} for opt in opts]):

/usr/lib64/python3.8/argparse.py in parse_args(self, args, namespace)
   1766     # =====================================
   1767     def parse_args(self, args=None, namespace=None):
-> 1768         args, argv = self.parse_known_args(args, namespace)
   1769         if argv:
   1770             msg = _('unrecognized arguments: %s')

/usr/lib64/python3.8/argparse.py in parse_known_args(self, args, namespace)
   1798         # parse the arguments and exit if there are any errors
   1799         try:
-> 1800             namespace, args = self._parse_known_args(args, namespace)
   1801             if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):
   1802                 args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))

/usr/lib64/python3.8/argparse.py in _parse_known_args(self, arg_strings, namespace)
   2004 
   2005             # consume the next optional and any arguments for it
-> 2006             start_index = consume_optional(start_index)
   2007 
   2008         # consume any positionals following the last Optional

/usr/lib64/python3.8/argparse.py in consume_optional(start_index)
   1944             assert action_tuples
   1945             for action, args, option_string in action_tuples:
-> 1946                 take_action(action, args, option_string)
   1947             return stop
   1948 

/usr/lib64/python3.8/argparse.py in take_action(action, argument_strings, option_string)
   1872             # (e.g. from a default)
   1873             if argument_values is not SUPPRESS:
-> 1874                 action(self, namespace, argument_values, option_string)
   1875 
   1876         # function to convert arg_strings into an optional action

/usr/lib64/python3.8/argparse.py in __call__(self, parser, namespace, values, option_string)
   1043     def __call__(self, parser, namespace, values, option_string=None):
   1044         parser.print_help()
-> 1045         parser.exit()
   1046 
   1047 

/usr/lib64/python3.8/argparse.py in exit(self, status, message)
   2506         if message:
   2507             self._print_message(message, _sys.stderr)
-> 2508         _sys.exit(status)
   2509 
   2510     def error(self, message):

SystemExit: 0

To Reproduce

Run %horus --help in a new notebook on https://jupyterhub-opf-jupyterhub.apps.smaug.na.operate-first.cloud/

mayaCostantini commented 2 years ago

/priority critical-urgent

harshad16 commented 2 years ago

please try %horus help https://github.com/thoth-station/jupyterlab-requirements/blob/master/docs/source/horus-magic-commands.md#help

codificat commented 2 years ago

please try %horus help

Good! But the bug here is that this should be the output of %horus --help (instead of the traceback), no?

I believe this would be a /sig user-experience improvement.

Given that the right command actually works, maybe: /remove-priority critical-urgent /priority important-soon

Gkrumbach07 commented 2 years ago

suggested actions

Gkrumbach07 commented 2 years ago

/triage accepted

Gkrumbach07 commented 2 years ago

/close

sesheta commented 2 years ago

@Gkrumbach07: Closing this issue.

In response to [this](https://github.com/thoth-station/jupyterlab-requirements/issues/632#issuecomment-1231604751): >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.