Skip to content

Commit

Permalink
Merge pull request #91 from paxtonfitzpatrick/rev-1
Browse files Browse the repository at this point in the history
bug fix for project type determination in colab notebooks
  • Loading branch information
paxtonfitzpatrick authored Aug 7, 2023
2 parents 4b238d7 + b7c1b9a commit 07f5e95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion davos/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ def _get_project_name_type(project_name):
)

project_type = ConcreteProject
if config.environment == 'Colaboratory':
# colab name/type logic works slightly differently -- there's
# only ever one "real" notebook per VM session, but it doesn't
# exist on the VM filesystem
curr_notebook_name = get_notebook_path()
if project_name == curr_notebook_name:
return project_name, project_type
return project_name, AbstractProject
if project_name.endswith('.ipynb'):
# `project_name` is a path to a notebook file, either the
# default (absolute path to the current notebook) or
Expand Down Expand Up @@ -849,5 +857,8 @@ def use_default_project():
else:
proj_name = get_notebook_path()

default_project = Project(proj_name)
# will always be an absolute path to a real Jupyter notebook file,
# or name of real Colab notebook, so we can skip project type
# decision logic
default_project = ConcreteProject(proj_name)
config.project = default_project
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = davos
version = 0.2.0
version = 0.2.1
description = Install and manage Python packages at runtime using the "smuggle" statement.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit 07f5e95

Please sign in to comment.