Skip to content

Commit 9fb791d

Browse files
authored
Merge pull request #196 from rstudio/mm-warn-no-requirements-file
Warn if no requirements.txt file
2 parents d3254bd + 4edb452 commit 9fb791d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

rsconnect/main.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,23 @@ def _warn_on_ignored_manifest(directory):
383383
"""
384384
if exists(join(directory, "manifest.json")):
385385
click.secho(
386-
" Warning: the existing manifest.json file will not be used or considered.", fg="yellow",
386+
" Warning: the existing manifest.json file will not be used or considered.",
387+
fg="yellow",
388+
)
389+
390+
391+
def _warn_if_no_requirements_file(directory):
392+
"""
393+
Checks for the existence of a file called requirements.txt in the given directory.
394+
If it's not there, a warning will be printed.
395+
396+
:param directory: the directory to check in.
397+
"""
398+
if not exists(join(directory, "requirements.txt")):
399+
click.secho(
400+
" Warning: Capturing the environment using 'pip freeze'.\n"
401+
" Consider creating a requirements.txt file instead.",
402+
fg="yellow",
387403
)
388404

389405

@@ -560,6 +576,7 @@ def deploy_notebook(
560576
click.secho(' Deploying %s to server "%s"' % (file, connect_server.url))
561577

562578
_warn_on_ignored_manifest(dirname(file))
579+
_warn_if_no_requirements_file(dirname(file))
563580

564581
with cli_feedback("Inspecting Python environment"):
565582
python, environment = get_python_env_info(file, python, conda, force_generate)
@@ -863,6 +880,7 @@ def _deploy_by_framework(
863880
click.secho(' Deploying %s to server "%s"' % (directory, connect_server.url))
864881

865882
_warn_on_ignored_manifest(directory)
883+
_warn_if_no_requirements_file(directory)
866884

867885
with cli_feedback("Inspecting Python environment"):
868886
_, environment = get_python_env_info(module_file, python, conda, force_generate)

0 commit comments

Comments
 (0)