feat: --package-manager option
Intent
Allows users to pass a --package-manager=pip|uv option to force a specific package manager.
By default it's up to the server (and it's backward compatible with server that didn't accept uv)
Closes #707
Type of Change
- [ ] Bug Fix
- [x] New Feature
- [ ] Breaking Change
Approach
The package_manager setting is now propagated in the Environment object and can be used by both deploy and write manifest processes.
Automated Tests
Added tests for the 3 cases
-
=uv -
=pip - omitted
Directions for Reviewers
If in doubt see https://docs.posit.co/connect/user/manifest/#python
Checklist
- [ ] I have updated CHANGELOG.md to cover notable changes.
- [x] I have updated all related GitHub issues to reflect their current state.
PR Preview Action v1.6.2 :---: |
:rocket: View preview athttps://posit-dev.github.io/rsconnect-python/pr-preview/pr-708/
|
Built to branch gh-pages at 2025-09-24 11:51 UTC.
Preview will be ready when the GitHub Pages deployment is complete.
☂️ Python Coverage
current status: ✅
Overall Coverage
| Lines | Covered | Coverage | Threshold | Status |
|---|---|---|---|---|
| 5172 | 4019 | 78% | 0% | 🟢 |
New Files
No new covered files...
Modified Files
| File | Coverage | Status |
|---|---|---|
| rsconnect/bundle.py | 80% | 🟢 |
| rsconnect/environment.py | 87% | 🟢 |
| rsconnect/main.py | 70% | 🟢 |
| TOTAL | 79% | 🟢 |
updated for commit:
2748daeby action🐍
I apologize in advance for the driveby comment about naming, but: given that "Package Manager" is one of Posit's products, I worry that calling this argument --package-manager is ambiguous or confusing. My instinct, without reading the docs, would be that I would provide a URL to the repository (Posit Package Manager) where I want packages to be downloaded from, not that this is how I would specify whether to use pip or uv pip.
I don't have an alternative to suggest, just wanted to flag this. Maybe this is fine?
I apologize in advance for the driveby comment about naming, but: given that "Package Manager" is one of Posit's products, I worry that calling this argument
--package-manageris ambiguous or confusing. My instinct, without reading the docs, would be that I would provide a URL to the repository (Posit Package Manager) where I want packages to be downloaded from, not that this is how I would specify whether to usepiporuv pip.I don't have an alternative to suggest, just wanted to flag this. Maybe this is fine?
I think "--package-installer" could work since this is strictly about installation and not other package management operations.
PyPI references "package installer": https://pypi.org/project/pip/
pip is the package installer for Python.
The Python Packaging guide also generally qualifies "installation" https://packaging.python.org/en/latest/guides/tool-recommendations/#installing-packages
The UV documentation is less precise: https://docs.astral.sh/uv/getting-started/features/#the-pip-interface
uv pip install: Install packages into the current environment.
I apologize in advance for the driveby comment about naming, but: given that "Package Manager" is one of Posit's products, I worry that calling this argument
--package-manageris ambiguous or confusing. My instinct, without reading the docs, would be that I would provide a URL to the repository (Posit Package Manager) where I want packages to be downloaded from, not that this is how I would specify whether to usepiporuv pip.
in Python specific terms that would probably be the "Package Index": https://pip.pypa.io/en/latest/cli/pip_search/#cmdoption-i
I guess that anyone using the PPM would be used to already specify that as the "index" both in requirements.txt and command line, so I feel it wouldn't confuse them much.
If we were in the R ecosystem I think your concern would have been very concrete, but in Python there is consistency from all tools to use the word Index and thus people are generally already exposed to it.
I think "--package-installer" could work since this is strictly about installation and not other package management operations.
I don't have a strong opinion, on this side there is a lot of confusion 🤷🏻
- UV docs -> An extremely fast Python package and project manager, written in Rust.
- Pip docs -> pip is the package installer for Python
- poetry docs -> Poetry is a tool for dependency management and packaging in Python
- conda docs -> Conda is a powerful command line tool for package and environment management
- pipx docs -> pix is a tool ... focused on installing and managing Python packages
What about having --use-pip and the mutually exclusive --use-uv? I know it's a little funky to have two options that are mutually exclusive, but in this case it gets us out of this bind. I don't think we need to worry too much that there will be large numbers of these so having many many options won't happen. And I also suspect that folks will have pip or uv closer at hand / as rigid designators rather than the specific class of things those things are. (eg: I'm pretty sure I hear more people say things like "Do you use pip or uv?" rather than hearing "Which package [manager|installer] do you use?").
I share Neal's concern that the unfortunate collision with the Posit product is likely to lead to confusion. If we had to we could recover from that being super explicit if someone puts something other than uv or pip in there, but this is an area that is already mildly confusing general, I would like to not add a log on that fire if we don't have to.