Mark py3 venv as default buildpack
MODIFY
repo2docker/app.py
repo2docker/app.py
@@ -19,7 +19,7 @@ import escapism
from traitlets.config import Application, LoggingConfigurable
-from traitlets import Type, Bool, Unicode, Dict, List, default
+from traitlets import Type, Bool, Unicode, Dict, List, default, Tuple
import docker
from docker.utils import kwargs_from_env
@@ -81,6 +81,15 @@ class Repo2Docker(Application):
"""
)
+ default_buildpack = Tuple(
+ (BaseImage, PythonBuildPack),
+ config=True,
+ help="""
+ The build pack to use when no buildpacks are found
+ """
+ )
+
+
cleanup_checkout = Bool(
True,
config=True,
@@ -299,11 +308,16 @@ class Repo2Docker(Application):
)
os.chdir(checkout_path)
+ picked_buildpack = c(self.default_buildpack)
+
for bp_spec in self.buildpacks:
bp = c(bp_spec)
if bp.detect():
+ picked_buildpack = bp
+ break
+
self.log.info('Using %s builder\n', bp.name, extra=dict(phase='building'))
- for l in bp.build(self.output_image_spec):
+ for l in picked_buildpack.build(self.output_image_spec):
if 'stream' in l:
self.log.info(l['stream'], extra=dict(phase='building'))
elif 'error' in l:
@@ -311,9 +325,6 @@ class Repo2Docker(Application):
sys.exit(1)
else:
self.log.info(json.dumps(l), extra=dict(phase='building'))
- break
- else:
- raise Exception("No builder found!")
if self.repo_type != 'local' and self.cleanup_checkout:
shutil.rmtree(checkout_path)

MODIFY
repo2docker/detectors.py
repo2docker/detectors.py
@@ -537,7 +537,7 @@ class PythonBuildPack(BuildPack):
return []
def detect(self):
- return os.path.exists('requirements.txt') and super()
+ return os.path.exists('requirements.txt') and super().detect()
class CondaBuildPack(BuildPack):
name = "conda"

ADD
tests/default/verify
+#!/usr/bin/env python
+# Verify that the default just provides a py3 environment with jupyter
+import sys
+
+assert sys.version_info[:2] == (3, 5)
+import jupyter

Mark py3 venv as default buildpack