Skip to content

Commit 82315e5

Browse files
committed
fix entrypoint not made with abspath
happened when path and entrypoint were provided and there were multiple notebooks in the deploy_dir
1 parent 294991c commit 82315e5

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

rsconnect/bundle.py

+1
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,7 @@ def create_voila_manifest(
16211621
else: # len(entrypoint_candidates) > 1:
16221622
if entrypoint is None:
16231623
raise RSConnectException(MULTI_NOTEBOOK_EXC_MSG)
1624+
entrypoint = abs_entrypoint(path, entrypoint)
16241625

16251626
if multi_notebook:
16261627
if path and not isdir(path):

tests/test_bundle.py

+55-1
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,8 @@ def test_is_not_executable(self):
810810
cur_dir = os.path.dirname(__file__)
811811
bqplot_dir = os.path.join(cur_dir, "./testdata/voila/bqplot/")
812812
bqplot_ipynb = os.path.join(bqplot_dir, "bqplot.ipynb")
813+
dashboard_dir = os.path.join(cur_dir, "./testdata/voila/dashboard/")
814+
dashboard_ipynb = os.path.join(dashboard_dir, "dashboard.ipynb")
813815
multivoila_dir = os.path.join(cur_dir, "./testdata/voila/multi-voila/")
814816

815817

@@ -863,7 +865,7 @@ def test_guess_deploy_dir(self):
863865
),
864866
],
865867
)
866-
def test_create_voila_manifest(path, entrypoint):
868+
def test_create_voila_manifest_1(path, entrypoint):
867869
environment = Environment(
868870
conda=None,
869871
contents="bqplot\n",
@@ -921,6 +923,58 @@ def test_create_voila_manifest(path, entrypoint):
921923
assert ans == json.loads(manifest.flattened_copy.json)
922924

923925

926+
@pytest.mark.parametrize(
927+
(
928+
"path",
929+
"entrypoint",
930+
),
931+
[
932+
(
933+
dashboard_dir,
934+
dashboard_ipynb,
935+
),
936+
],
937+
)
938+
def test_create_voila_manifest_2(path, entrypoint):
939+
environment = Environment(
940+
conda=None,
941+
contents="numpy\nipywidgets\nbqplot\n",
942+
error=None,
943+
filename="requirements.txt",
944+
locale="en_US.UTF-8",
945+
package_manager="pip",
946+
pip="23.0",
947+
python="3.8.12",
948+
source="file",
949+
)
950+
ans = {
951+
"version": 1,
952+
"locale": "en_US.UTF-8",
953+
"metadata": {"appmode": "jupyter-voila", "entrypoint": "dashboard.ipynb"},
954+
"python": {
955+
"version": "3.8.12",
956+
"package_manager": {"name": "pip", "version": "23.0", "package_file": "requirements.txt"},
957+
},
958+
"files": {
959+
"requirements.txt": {"checksum": "d51994456975ff487749acc247ae6d63"},
960+
"bqplot.ipynb": {"checksum": "79f8622228eded646a3038848de5ffd9"},
961+
"dashboard.ipynb": {"checksum": "6b42a0730d61e5344a3e734f5bbeec25"},
962+
},
963+
}
964+
manifest = create_voila_manifest(
965+
path,
966+
entrypoint,
967+
environment,
968+
app_mode=AppModes.JUPYTER_VOILA,
969+
extra_files=None,
970+
excludes=None,
971+
force_generate=True,
972+
image=None,
973+
multi_notebook=False,
974+
)
975+
assert ans == json.loads(manifest.flattened_copy.json)
976+
977+
924978
@pytest.mark.parametrize(
925979
(
926980
"path",

0 commit comments

Comments
 (0)