From 885cb464b6904ae56a356cc858135d93ce1359ac Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Wed, 26 Jan 2022 14:45:38 +0530 Subject: [PATCH] Allow passing in traitlets via commandline Without this, you *always* needed a repo2docker_config.py file to configure anything. This PR makes r2d match the behavior of most traitlets based applications (like jupyter_server, jupyterhub, nbconvert, etc) Fixes https://github.com/jupyterhub/repo2docker/issues/1112 --- repo2docker/__main__.py | 3 ++- repo2docker/app.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/repo2docker/__main__.py b/repo2docker/__main__.py index 099161693..c4e46e198 100644 --- a/repo2docker/__main__.py +++ b/repo2docker/__main__.py @@ -251,9 +251,10 @@ def make_r2d(argv=None): print(__version__) sys.exit(0) - args = get_argparser().parse_args(argv) + args, traitlet_args = get_argparser().parse_known_args(argv) r2d = Repo2Docker() + r2d.parse_command_line(traitlet_args) if args.debug: r2d.log_level = logging.DEBUG diff --git a/repo2docker/app.py b/repo2docker/app.py index a03fe1df2..ce49fc7f4 100755 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -490,7 +490,7 @@ def json_excepthook(self, etype, evalue, traceback): extra=dict(phase="failed"), ) - def initialize(self): + def initialize(self, *args, **kwargs): """Init repo2docker configuration before start""" # FIXME: Remove this function, move it to setters / traitlet reactors if self.json_logs: