Skip to content

Commit 0243728

Browse files
committed
Simplify logic and test, update docstring
1 parent bf61f27 commit 0243728

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

rsconnect/bundle.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ def get_default_entrypoint(directory):
14261426
app_files = list(filter(lambda s: re_app_prefix.match(s) or re_app_suffix.match(s), python_files))
14271427
if len(app_files) == 1:
14281428
# In these cases, the app should be in the "app" attribute
1429-
return app_files[0][:-3] + ":app"
1429+
return app_files[0][:-3]
14301430

14311431
raise RSConnectException(f"Could not determine default entrypoint file in directory '{directory}'")
14321432

@@ -1435,10 +1435,11 @@ def validate_entry_point(entry_point, directory):
14351435
"""
14361436
Validates the entry point specified by the user, expanding as necessary. If the
14371437
user specifies nothing, a module of "app" is assumed. If the user specifies a
1438-
module only, the object is assumed to be the same name as the module.
1438+
module only, at runtime the following object names will be tried in order: `app`,
1439+
`application`, `create_app`, and `make_app`.
14391440
14401441
:param entry_point: the entry point as specified by the user.
1441-
:return: the fully expanded and validated entry point and the module file name..
1442+
:return: An entry point, in the form of "module" or "module:app".
14421443
"""
14431444
if not entry_point:
14441445
entry_point = get_default_entrypoint(directory)

tests/test_bundle.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,9 @@ def test_validate_title(self):
10821082

10831083
def test_validate_entry_point(self):
10841084
# Simple cases
1085-
for case in ["app", "application", "main", "api"]:
1085+
for case in ["app", "application", "main", "api", "app-example", "app_example", "example-app", "example_app"]:
10861086
self._entry_point_case(["helper.py", f"{case}.py"], None, case)
10871087

1088-
# app patterns; these differ because they come back with ":app"
1089-
for case in ["app-example", "app_example", "example-app", "example_app"]:
1090-
self._entry_point_case(["helper.py", f"{case}.py"], None, f"{case}:app")
1091-
10921088
# only one Python file means we assume it's the entrypoint
10931089
self._entry_point_case(["onlysource.py"], None, "onlysource")
10941090

0 commit comments

Comments
 (0)