posit-dev / posit-dev/rsconnect-python

`--package-installer` silently ignored in two commands and unusable as documented on click >= 8.2

オープン
#852 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
37
フォーク
28
平均マージ
1日 3時間
マージ済み PR(30日)
7

説明

--package-installer was added in #708 (c1450c57). It does not work as documented in two independent ways. Neither is visible to the current test suite.

1. write-manifest <framework> and deploy quarto accept the option and ignore it

Two code paths take package_installer and never forward it to Environment.create_python_environment:

  • _write_framework_manifest in rsconnect/main.py, shared by write-manifest streamlit|dash|bokeh|panel|shiny|api|fastapi. The call passes requirements_file, override_python_version, and python, but not package_manager.
  • deploy_quarto in rsconnect/main.py. Same omission in its create_python_environment call.

The other commands added in #708 (deploy notebook|voila|<framework>, write-manifest notebook|voila|quarto) do pass package_manager=package_installer. git log -S "package_manager=package_installer" -- rsconnect/main.py returns only #708, so these two sites were never wired rather than wired and later lost.

Repro on click 8.1.8 (the version in uv.lock; see issue 2 for why the version matters):

$ rsconnect write-manifest shiny --overwrite --package-installer uv ./app
Checking arguments...                            [OK]
Inspecting Python environment...                 [OK]
Inspecting Shiny for Python app...               [OK]
Creating manifest.json...                        [OK]
$ python -c "import json; print(json.load(open('app/manifest.json'))['python']['package_manager'])"
{'name': 'pip', 'version': '26.2.1', 'package_file': 'requirements.txt'}

Expected {'name': 'uv', ...}. The command exits 0 with no warning.

Consequence: deploy <framework> honors the option and write-manifest <framework> does not, so write-manifest followed by deploy manifest installs differently from the equivalent direct deploy.

2. The documented uv spelling is rejected on click >= 8.2

The option is declared as type=click.Choice(PackageInstaller) over a StrEnum. click 8.2.0 changed Choice to match enum members by name instead of by value, so the accepted spelling flips with the click version:

click --package-installer uv --package-installer UV
8.1.8 accepted rejected
8.2.1 rejected accepted
8.3.1 rejected accepted

On click 8.3.1:

$ rsconnect write-manifest shiny --overwrite --package-installer uv ./app
Error: Invalid value for '--package-installer': 'uv' is not one of 'PIP', 'UV'.

The changelog documents --package-installer=uv|pip. pyproject.toml declares click>=8.0.0 with no upper bound, so a fresh install today resolves a click where the documented invocation fails. On those versions --help also advertises the choices as PIP|UV, disagreeing with the changelog. No single spelling works across the declared click range.

This works in the repository checkout only because uv.lock pins click 8.1.8.

Why neither shows up in CI

grep -rn "package_installer" tests/ returns nothing. #708's tests cover the bundle writer at the unit level and never invoke the CLI option. Issue 1 is invisible to those tests, and issue 2 cannot appear while the lock holds click 8.1.8.

Suggested fixes

  1. Pass package_manager=package_installer in the create_python_environment calls in _write_framework_manifest and deploy_quarto.
  2. Declare the option as click.Choice(["pip", "uv"]) and convert to PackageInstaller afterward, so the lowercase spelling works on every supported click. Bounding click would also work, at the cost of what users can install alongside.
  3. Add a CLI-level test that asserts manifest["python"]["package_manager"]["name"] for write-manifest and deploy across the app-mode families.

Environment

  • rsconnect-python 1.31.2.dev1 (main, 3d3f5841)
  • click 8.1.8 (from uv.lock) and click 8.3.1 (fresh resolve)
  • Python 3.12, macOS

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

rsconnect/main.py の _write_framework_manifest と deploy_quarto を読み、続いて package_installer オプションの宣言と既存の CLI テストを確認してください。pyproject.toml と uv.lock には、サポートされている click のバージョンが示されています。write-manifest と deploy のカバレッジを追加し、選択した installer が manifest に到達することと、宣言された click のバージョン範囲全体で小文字の uv が受け入れられることを検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli, testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
78/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。