`--package-installer` silently ignored in two commands and unusable as documented on click >= 8.2
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- cli, testing-qa
调研方向
阅读 rsconnect/main.py 中的 _write_framework_manifest 和 deploy_quarto,然后检查 package_installer 选项声明及现有的 CLI 测试;pyproject.toml 和 uv.lock 显示了受支持的 click 版本。为 write-manifest 和 deploy 添加覆盖测试,验证所选 installer 能到达 manifest,并验证在声明的 click 版本范围内均接受小写的 uv。
由索引模型根据 Issue 内容生成。
描述
--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_manifestinrsconnect/main.py, shared bywrite-manifest streamlit|dash|bokeh|panel|shiny|api|fastapi. The call passesrequirements_file,override_python_version, andpython, but notpackage_manager.deploy_quartoinrsconnect/main.py. Same omission in itscreate_python_environmentcall.
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
- Pass
package_manager=package_installerin thecreate_python_environmentcalls in_write_framework_manifestanddeploy_quarto. - Declare the option as
click.Choice(["pip", "uv"])and convert toPackageInstallerafterward, so the lowercase spelling works on every supported click. Bounding click would also work, at the cost of what users can install alongside. - Add a CLI-level test that asserts
manifest["python"]["package_manager"]["name"]forwrite-manifestanddeployacross 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
- 主要语言
- Python
- 星标
- 38
- 派生
- 28
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 59
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
posit-dev/rsconnect-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
posit-dev/rsconnect-python#998 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
posit-dev/rsconnect-python#786 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
posit-dev/rsconnect-python#543 · 2 条评论 ·
维护者通常 1 天内回复
-
Write no installer preference for uv.lock bundles可能已有人在做 @tdstein 于 2 天前认领。 未关闭enhancement ready-for-agent
posit-dev/rsconnect-python#996 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Evaluate Python dependency source precedence可能已有人在做 @tdstein 于 13 天前认领。 未关闭enhancement ready-for-agent
难度 4/5 1-2 天 新手友好度 52/100
posit-dev/rsconnect-python#975 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 posit-dev/rsconnect-python 的全部 Issue
相似的 Issue
-
app: scripts status: backlog type: housekeeping
难度 1/5 1-3 小时 新手友好度 88/100
netbox-community/netbox-scripts#239 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
LmeSzinc/AzurLaneAutoScript#6194 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
micronaut-projects/micronaut-core#14585 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
langgenius/graphon#443 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复