Skip to content

add is_python_enabled_on_server #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rsconnect/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,15 @@ def fake_module_file_from_directory(directory: str):
return join(directory, app_name + ".py")


def is_python_enabled_on_server(connect_details):
"""
Returns whether or not the Connect server has Python itself enabled.

:error: The Posit Connect server does not have Python enabled.
"""
return any(connect_details.get("python", {}).get("versions", []))


def are_apis_supported_on_server(connect_details):
"""
Returns whether or not the Connect server has Python itself enabled and its license allows
Expand Down
3 changes: 2 additions & 1 deletion rsconnect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from . import api, VERSION, validation
from .api import RSConnectExecutor, RSConnectServer, RSConnectClient, filter_out_server_info
from .bundle import (
is_python_enabled_on_server,
are_apis_supported_on_server,
create_python_environment,
default_title_from_manifest,
Expand Down Expand Up @@ -1306,7 +1307,7 @@ def deploy_app(
(
ce.validate_server()
.validate_app_mode(app_mode=app_mode)
.check_server_capabilities([are_apis_supported_on_server])
.check_server_capabilities([is_python_enabled_on_server, are_apis_supported_on_server])
.make_bundle(
make_api_bundle,
directory,
Expand Down