Skip to content

Commit 55a730d

Browse files
authored
Merge pull request #535 from rstudio/aron-issue-534
quarto: address inconsistencies between deprecated and live implementations
2 parents 1f6f75d + 1d23067 commit 55a730d

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
should help prevent users from getting stuck a "build already running" state.
2828
See [#467](https://github.com/rstudio/rsconnect-python/issues/467) for details.
2929

30+
- Addressed an error which occurred when attempting to create manifests for
31+
Quarto documents. (#534)
32+
3033
## [1.21.0] - 2023-10-26
3134

3235
### Fixed

rsconnect/actions.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
make_notebook_html_bundle,
3333
make_notebook_source_bundle,
3434
make_quarto_source_bundle,
35-
make_quarto_manifest,
3635
make_source_manifest,
3736
manifest_add_buffer,
3837
manifest_add_file,
@@ -518,8 +517,7 @@ def write_quarto_manifest_json(
518517
The server administrator is responsible for installing packages in the runtime environment. Default = None.
519518
"""
520519
warn("This method has been moved and will be deprecated.", DeprecationWarning, stacklevel=2)
521-
522-
manifest, _ = make_quarto_manifest(
520+
bundle.write_quarto_manifest_json(
523521
file_or_directory,
524522
inspect,
525523
app_mode,
@@ -531,21 +529,13 @@ def write_quarto_manifest_json(
531529
env_management_r,
532530
)
533531

534-
base_dir = file_or_directory
535-
if not isdir(file_or_directory):
536-
base_dir = dirname(file_or_directory)
537-
manifest_path = join(base_dir, "manifest.json")
538-
write_manifest_json(manifest_path, manifest)
539-
540532

541533
def write_manifest_json(manifest_path, manifest):
542534
"""
543535
Write the manifest data as JSON to the named manifest.json with a trailing newline.
544536
"""
545537
warn("This method has been moved and will be deprecated.", DeprecationWarning, stacklevel=2)
546-
with open(manifest_path, "w") as f:
547-
json.dump(manifest, f, indent=2)
548-
f.write("\n")
538+
bundle.write_manifest_json(manifest_path, manifest)
549539

550540

551541
def deploy_html(

rsconnect/bundle.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ def make_quarto_manifest(
13241324
# Standalone Quarto document
13251325
base_dir = dirname(file_or_directory)
13261326
file_name = basename(file_or_directory)
1327-
relevant_files = [file_name] + extra_files
1327+
relevant_files = [file_name] + list(extra_files or [])
13281328

13291329
manifest = make_source_manifest(
13301330
app_mode,
@@ -2015,7 +2015,7 @@ def describe_manifest(
20152015

20162016

20172017
def write_quarto_manifest_json(
2018-
directory: str,
2018+
file_or_directory: str,
20192019
inspect: typing.Any,
20202020
app_mode: AppMode,
20212021
environment: Environment,
@@ -2028,7 +2028,7 @@ def write_quarto_manifest_json(
20282028
"""
20292029
Creates and writes a manifest.json file for the given Quarto project.
20302030
2031-
:param directory: The directory containing the Quarto project.
2031+
:param file_or_directory: The Quarto document or the directory containing the Quarto project.
20322032
:param inspect: The parsed JSON from a 'quarto inspect' against the project.
20332033
:param app_mode: The application mode to assume (such as AppModes.STATIC_QUARTO)
20342034
:param environment: The (optional) Python environment to use.
@@ -2041,12 +2041,20 @@ def write_quarto_manifest_json(
20412041
The server administrator is responsible for installing packages in the runtime environment. Default = None.
20422042
"""
20432043

2044-
extra_files = validate_extra_files(directory, extra_files)
20452044
manifest, _ = make_quarto_manifest(
2046-
directory, inspect, app_mode, environment, extra_files, excludes, image, env_management_py, env_management_r
2045+
file_or_directory,
2046+
inspect,
2047+
app_mode,
2048+
environment,
2049+
extra_files,
2050+
excludes,
2051+
image,
20472052
)
2048-
manifest_path = join(directory, "manifest.json")
20492053

2054+
base_dir = file_or_directory
2055+
if not isdir(file_or_directory):
2056+
base_dir = dirname(file_or_directory)
2057+
manifest_path = join(base_dir, "manifest.json")
20502058
write_manifest_json(manifest_path, manifest)
20512059

20522060

tests/test_main_content.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# For some reason setup and teardown aren't enough to fully reset the state
2020
# between tests. Overriding the env var CONNECT_CONTENT_BUILD_DIR to be a tempdir
2121
# would be preferable but this is fine for now.
22-
TEMP_DIR="rsconnect-build-test"
22+
TEMP_DIR = "rsconnect-build-test"
2323

2424
def register_uris(connect_server: str):
2525
def register_content_endpoints(i: int, guid: str):
@@ -39,8 +39,8 @@ def register_content_endpoints(i: int, guid: str):
3939
httpretty.GET,
4040
f"{connect_server}/__api__/applications/{guid}/config",
4141
body='{' +
42-
f'"config_url": "{connect_server}/connect/#/apps/{guid}",' +
43-
f'"logs_url": "{connect_server}/connect/#/apps/{guid}"' +
42+
f'"config_url": "{connect_server}/connect/#/apps/{guid}",' +
43+
f'"logs_url": "{connect_server}/connect/#/apps/{guid}"' +
4444
'}',
4545
adding_headers={"Content-Type": "application/json"},
4646
)

0 commit comments

Comments
 (0)