Skip to content

Conversation

amol-
Copy link
Collaborator

@amol- amol- commented Sep 18, 2025

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
  • 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.
  • I have updated all related GitHub issues to reflect their current state.

Copy link

github-actions bot commented Sep 18, 2025

PR Preview Action v1.6.2

🚀 View preview at
https://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.

@amol- amol- changed the title first import feat: --package-manager option Sep 18, 2025
Copy link

github-actions bot commented Sep 18, 2025

☂️ 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: 2748dae by action🐍

@nealrichardson
Copy link
Contributor

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?

@tdstein
Copy link
Collaborator

tdstein commented Sep 24, 2025

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 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

pip is the standard tool to install packages from PyPI.

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.

@amol-
Copy link
Collaborator Author

amol- commented Sep 24, 2025

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.

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.

@amol-
Copy link
Collaborator Author

amol- commented Sep 24, 2025

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

@amol- amol- marked this pull request as ready for review September 24, 2025 15:05
@jonkeane
Copy link
Collaborator

jonkeane commented Oct 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow enforcing a specific package manager
4 participants