Skip to content

spcs support #660

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test = [
"twine",
"types-Flask",
]
snowflake = ["snowflake-cli"]

[project.urls]
Repository = "http://github.com/posit-dev/rsconnect-python"
Expand Down
8 changes: 8 additions & 0 deletions rsconnect/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ def test_rstudio_server(server: api.PositServer):
raise RSConnectException("Failed to verify with {} ({}).".format(server.remote_name, exc))


def test_spcs_server(server: api.SPCSConnectServer):
with api.RSConnectClient(server) as client:
try:
client.me()
except RSConnectException as exc:
raise RSConnectException("Failed to verify with {} ({}).".format(server.remote_name, exc))


def test_api_key(connect_server: api.RSConnectServer) -> str:
"""
Test that an API Key may be used to authenticate with the given Posit Connect server.
Expand Down
26 changes: 13 additions & 13 deletions rsconnect/actions_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import semver

from .api import RSConnectClient, RSConnectServer, emit_task_log
from .api import PositConnectServer, RSConnectClient, emit_task_log
from .exception import RSConnectException
from .log import logger
from .metadata import ContentBuildStore, ContentItemWithBuildState
Expand All @@ -33,7 +33,7 @@ def content_build_store() -> ContentBuildStore:
return _content_build_store


def ensure_content_build_store(connect_server: RSConnectServer) -> ContentBuildStore:
def ensure_content_build_store(connect_server: PositConnectServer) -> ContentBuildStore:
global _content_build_store
if not _content_build_store:
logger.info("Initializing ContentBuildStore for %s" % connect_server.url)
Expand All @@ -42,7 +42,7 @@ def ensure_content_build_store(connect_server: RSConnectServer) -> ContentBuildS


def build_add_content(
connect_server: RSConnectServer,
connect_server: PositConnectServer,
content_guids_with_bundle: Sequence[ContentGuidWithBundle],
):
"""
Expand Down Expand Up @@ -85,7 +85,7 @@ def _validate_build_rm_args(guid: Optional[str], all: bool, purge: bool):


def build_remove_content(
connect_server: RSConnectServer,
connect_server: PositConnectServer,
guid: Optional[str],
all: bool,
purge: bool,
Expand All @@ -109,20 +109,20 @@ def build_remove_content(
return guids


def build_list_content(connect_server: RSConnectServer, guid: str, status: Optional[str]):
def build_list_content(connect_server: PositConnectServer, guid: str, status: Optional[str]):
build_store = ensure_content_build_store(connect_server)
if guid:
return [build_store.get_content_item(g) for g in guid]
else:
return build_store.get_content_items(status=status)


def build_history(connect_server: RSConnectServer, guid: str):
def build_history(connect_server: PositConnectServer, guid: str):
return ensure_content_build_store(connect_server).get_build_history(guid)


def build_start(
connect_server: RSConnectServer,
connect_server: PositConnectServer,
parallelism: int,
aborted: bool = False,
error: bool = False,
Expand Down Expand Up @@ -251,7 +251,7 @@ def build_start(
build_monitor.shutdown()


def _monitor_build(connect_server: RSConnectServer, content_items: list[ContentItemWithBuildState]):
def _monitor_build(connect_server: PositConnectServer, content_items: list[ContentItemWithBuildState]):
"""
:return bool: True if the build completed without errors, False otherwise
"""
Expand Down Expand Up @@ -296,7 +296,7 @@ def _monitor_build(connect_server: RSConnectServer, content_items: list[ContentI
return True


def _build_content_item(connect_server: RSConnectServer, content: ContentItemWithBuildState, poll_wait: int):
def _build_content_item(connect_server: PositConnectServer, content: ContentItemWithBuildState, poll_wait: int):
build_store = ensure_content_build_store(connect_server)
with RSConnectClient(connect_server) as client:
# Pending futures will still try to execute when ThreadPoolExecutor.shutdown() is called
Expand Down Expand Up @@ -351,7 +351,7 @@ def write_log(line: str):


def emit_build_log(
connect_server: RSConnectServer,
connect_server: PositConnectServer,
guid: str,
format: str,
task_id: Optional[str] = None,
Expand All @@ -369,7 +369,7 @@ def emit_build_log(
raise RSConnectException("Log file not found for content: %s" % guid)


def download_bundle(connect_server: RSConnectServer, guid_with_bundle: ContentGuidWithBundle):
def download_bundle(connect_server: PositConnectServer, guid_with_bundle: ContentGuidWithBundle):
"""
:param guid_with_bundle: models.ContentGuidWithBundle
"""
Expand All @@ -387,7 +387,7 @@ def download_bundle(connect_server: RSConnectServer, guid_with_bundle: ContentGu
return client.download_bundle(guid_with_bundle.guid, guid_with_bundle.bundle_id)


def get_content(connect_server: RSConnectServer, guid: str | list[str]):
def get_content(connect_server: PositConnectServer, guid: str | list[str]):
"""
:param guid: a single guid as a string or list of guids.
:return: a list of content items.
Expand All @@ -401,7 +401,7 @@ def get_content(connect_server: RSConnectServer, guid: str | list[str]):


def search_content(
connect_server: RSConnectServer,
connect_server: PositConnectServer,
published: bool,
unpublished: bool,
content_type: Sequence[str],
Expand Down
Loading
Loading