posit-dev / posit-dev/rsconnect-python

deploy manifest errs when give a directory containing a manifest

Open
#587 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
37
Forks
28
Avg merge
1d 3h
Merged PRs (30d)
7

Description

The help for deploy manifest reads:

Usage: rsconnect deploy manifest [OPTIONS] FILE

  Deploy content to Posit Connect, Posit Cloud, or shinyapps.io using an
  existing manifest.json file.  The specified file must either be named
  "manifest.json" or refer to a directory that contains a file named
  "manifest.json".

However, when providing a directory that contains a manifest.json, an error results.

Traceback (most recent call last):
  File "BASE_DIR/env/lib/python3.11/site-packages/rsconnect/main.py", line 108, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "BASE_DIR/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "BASE_DIR/env/lib/python3.11/site-packages/rsconnect/main.py", line 1119, in deploy_manifest
    kwargs["title"] = title or default_title_from_manifest(file)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "BASE_DIR/env/lib/python3.11/site-packages/rsconnect/bundle.py", line 744, in default_title_from_manifest
    source_manifest, _ = read_manifest_file(file)
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "BASE_DIR/env/lib/python3.11/site-packages/rsconnect/bundle.py", line 757, in read_manifest_file
    with open(manifest_path, "rb") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: 'model'
Internal error: [Errno 21] Is a directory: 'model'

Providing the path to the manifest.json works.

# error
rsconnect deploy manifest model
# no error
rsconnect deploy manifest model/manifest.json

Using rsconnect-python 1.23.0.

The manifest is correctly identified:

rsconnect.bundle.validate_manifest_file("model")
#> 'model/manifest.json'

However, in deploy_manifest(), we rewrite the incoming file to file_name but do not consistently use that variable.

https://github.com/rstudio/rsconnect-python/blob/74b7f6899206ff754e29ad282c3dc725ab4e186b/rsconnect/main.py#L1146-L1179

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in rsconnect/main.py at deploy_manifest(), then follow default_title_from_manifest() and read_manifest_file() in rsconnect/bundle.py. Compare how file and file_name are used after manifest validation, and verify both rsconnect deploy manifest model and the direct manifest path complete without the directory error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.