Skip to content

Commit 07f5e95

Browse files
Merge pull request #91 from paxtonfitzpatrick/rev-1
bug fix for project type determination in colab notebooks
2 parents 4b238d7 + b7c1b9a commit 07f5e95

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

davos/core/project.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ def _get_project_name_type(project_name):
493493
)
494494

495495
project_type = ConcreteProject
496+
if config.environment == 'Colaboratory':
497+
# colab name/type logic works slightly differently -- there's
498+
# only ever one "real" notebook per VM session, but it doesn't
499+
# exist on the VM filesystem
500+
curr_notebook_name = get_notebook_path()
501+
if project_name == curr_notebook_name:
502+
return project_name, project_type
503+
return project_name, AbstractProject
496504
if project_name.endswith('.ipynb'):
497505
# `project_name` is a path to a notebook file, either the
498506
# default (absolute path to the current notebook) or
@@ -849,5 +857,8 @@ def use_default_project():
849857
else:
850858
proj_name = get_notebook_path()
851859

852-
default_project = Project(proj_name)
860+
# will always be an absolute path to a real Jupyter notebook file,
861+
# or name of real Colab notebook, so we can skip project type
862+
# decision logic
863+
default_project = ConcreteProject(proj_name)
853864
config.project = default_project

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = davos
3-
version = 0.2.0
3+
version = 0.2.1
44
description = Install and manage Python packages at runtime using the "smuggle" statement.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)