From b5988f83c1cfffb639e3d18fe1a33b62ab192bc1 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 16 Jul 2018 10:01:50 +0200 Subject: [PATCH 1/5] from traitlets import TraitError in utils.py __TraitError__ is used on lines 259 and 266 but it is neither imported nor defined which will cause a __NameError__ to be raised instead of a __TraitError__. flake8 testing of https://github.com/jupyter/repo2docker on Python 3.6.3 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./repo2docker/utils.py:259:19: F821 undefined name 'TraitError' raise TraitError( ^ ./repo2docker/utils.py:266:19: F821 undefined name 'TraitError' raise TraitError( ^ 2 F821 undefined name 'TraitError' 2 ``` --- repo2docker/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo2docker/utils.py b/repo2docker/utils.py index 2912fac9..7df5ae8d 100644 --- a/repo2docker/utils.py +++ b/repo2docker/utils.py @@ -5,7 +5,7 @@ import shutil import subprocess import sys -from traitlets import Integer +from traitlets import Integer, TraitError def execute_cmd(cmd, capture=False, **kwargs): From a87f9520f1287d1be10b20c1c58111d97aac3832 Mon Sep 17 00:00:00 2001 From: Vanessa Sochat Date: Mon, 16 Jul 2018 06:05:43 -0700 Subject: [PATCH 2/5] adding version argument --- repo2docker/app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/repo2docker/app.py b/repo2docker/app.py index b4d9f900..c4569fdf 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -217,6 +217,7 @@ class Repo2Docker(Application): def get_argparser(self): """Get arguments that may be used by repo2docker""" argparser = argparse.ArgumentParser() + argparser.add_argument( '--config', default='repo2docker_config.py', @@ -342,6 +343,15 @@ class Repo2Docker(Application): type=str, help=self.traits()['appendix'].help, ) + + argparser.add_argument( + '--version', + dest='version', + action='store_true', + help='Print the repo2docker version and exit.' + ) + + return argparser def json_excepthook(self, etype, evalue, traceback): @@ -353,10 +363,16 @@ class Repo2Docker(Application): exc_info=(etype, evalue, traceback), extra=dict(phase='failed')) + def initialize(self, argv=None): """Init repo2docker configuration before start""" if argv is None: argv = sys.argv[1:] + + if '--version' in argv: + print(self.version) + sys.exit(0) + args = self.get_argparser().parse_args(argv) if args.debug: From 80d7ec9ff37d499ce862c62d5a697dc1687b0143 Mon Sep 17 00:00:00 2001 From: Vanessa Sochat Date: Mon, 16 Jul 2018 06:46:53 -0700 Subject: [PATCH 3/5] removing extra blank lines --- repo2docker/app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/repo2docker/app.py b/repo2docker/app.py index c4569fdf..a602e48c 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -351,7 +351,6 @@ class Repo2Docker(Application): help='Print the repo2docker version and exit.' ) - return argparser def json_excepthook(self, etype, evalue, traceback): @@ -363,7 +362,6 @@ class Repo2Docker(Application): exc_info=(etype, evalue, traceback), extra=dict(phase='failed')) - def initialize(self, argv=None): """Init repo2docker configuration before start""" if argv is None: From 21f698c1b72a13ca727e81ca45e654635eea4670 Mon Sep 17 00:00:00 2001 From: Vanessa Sochat Date: Mon, 16 Jul 2018 06:47:59 -0700 Subject: [PATCH 4/5] adding note to future developers about why version is checked first --- repo2docker/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repo2docker/app.py b/repo2docker/app.py index a602e48c..7f658852 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -367,6 +367,8 @@ class Repo2Docker(Application): if argv is None: argv = sys.argv[1:] + # version must be checked before parse, as repo/cmd are required and + # will spit out an error if allowed to be parsed first. if '--version' in argv: print(self.version) sys.exit(0) From 85575f052485ad2727f5f6a59a1e544ae7000e61 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Tue, 17 Jul 2018 17:42:58 +0200 Subject: [PATCH 5/5] Switch from PyDataScienceHandbook to Pytudes The data science handbook build has been broken for a while and users end up with an error while following our documentation. --- docs/source/usage.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source/usage.rst b/docs/source/usage.rst index a88dc7b5..fe450c28 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -20,15 +20,15 @@ repo2docker is called with this command:: where ```` is a URL or path to the source repository. -For example, use the following to build an image of the -`Python Data Science Handbook `_:: +For example, use the following to build an image of Peter Norvig's +`Pytudes `_:: - jupyter-repo2docker https://github.com/jakevdp/PythonDataScienceHandbook + jupyter-repo2docker https://github.com/norvig/pytudes To build a particular branch and commit, use the argument ``--ref`` to specify the ``branch-name`` or ``commit-hash``:: - jupyter-repo2docker https://github.com/jakevdp/PythonDataScienceHandbook --ref 599aa0fe3f882c0001670e676e5a8d43b92c35fc + jupyter-repo2docker https://github.com/norvig/pytudes --ref 9ced85dd9a84859d0767369e58f33912a214a3cf .. tip:: For reproducibile research, we recommend specifying a commit-hash to @@ -47,8 +47,8 @@ Python 3.6 unless you include the version of Python in your Python 2.7, 3.5, and 3.6. In the case of this repo, a Python version is not specified in their configuation files and Python 3.6 is installed. -`Python Data Science Handbook `_ -uses a `requirements.txt file `_ +`Pytudes `_ +uses a `requirements.txt file `_ to specify its Python environment. ``repo2docker`` uses ``pip`` to install dependencies listed in the ``requirement.txt`` in the image. To learn more about configuration files in ``repo2docker`` visit :ref:`config-files`. @@ -86,7 +86,7 @@ To debug the docker image being built, pass the ``--debug`` parameter: .. code-block:: bash - jupyter-repo2docker --debug https://github.com/jakevdp/PythonDataScienceHandbook + jupyter-repo2docker --debug https://github.com/norvig/pytudes This will print the generated ``Dockerfile``, build it, and run it. @@ -97,4 +97,4 @@ be used by docker directly. .. code-block:: bash - jupyter-repo2docker --no-build --debug https://github.com/jakevdp/PythonDataScienceHandbook + jupyter-repo2docker --no-build --debug https://github.com/norvig/pytudes