Issue #3707 - #3709
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3709 +/- ##
=======================================
Coverage 79.31% 79.31%
=======================================
Files 885 885
Lines 65365 65365
Branches 2543 2543
=======================================
+ Hits 51846 51847 +1
+ Misses 12847 12846 -1
Partials 672 672
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uv sync exits 0 while installing nothing for a non-PEP-621 pyproject.toml, so gate path 2 on a [project] table and on requirements.txt being absent; poetry/pdm plugins now fall through to uv pip install instead of getting an empty venv and a runtime ModuleNotFoundError. Also drop the stale venv-base uv.lock so a widened pin re-resolves, and pass --inexact on both sync paths so admin-uploaded packages are no longer pruned. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
| # lock exactly and uninstalls anything else, including packages an admin | ||
| # uploaded into this plugin venv via PythonPackageModel.install (which uses | ||
| # the additive `pipinstall`). | ||
| uv_offline_then_online sync --frozen --inexact --no-dev --no-install-project ${UV_ARGS} |
There was a problem hiding this comment.
--inexact was an existing issue
| # does install the deps, so those plugins must fall through to it. | ||
| # - requirements.txt must be absent. A pyproject.toml carrying only tool | ||
| # config ([tool.ruff], [tool.pytest]) alongside a real requirements.txt | ||
| # would otherwise match here and the requirements.txt would never be read. |
There was a problem hiding this comment.
Added extra gates to prevent uv sync noop
|
The fallback step can be rewritten like if [ -f "${GEM_PATH}/requirements.txt" ]; then
uv_offline_then_online pip install --python "${VENV_DIR}" ${UV_ARGS} -r "${GEM_PATH}/requirements.txt"
RESULT=$?
elif [ -f "${GEM_PATH}/pyproject.toml" ]; then
uv_offline_then_online pip install --python "${VENV_DIR}" ${UV_ARGS} -r "${GEM_PATH}/pyproject.toml"
RESULT=$?
else
echo "ERROR: No requirements.txt, pyproject.toml, or uv.lock found in ${GEM_PATH}"
exit 1
fiAlso make sure the # Build the argv array for pypi index and trusted-host arguments.
def self.build_pypi_args(pypi_url)
args = ["-i", pypi_url]
args += ["--trusted-host", URI.parse(pypi_url).host] unless ENV['PIP_ENABLE_TRUSTED_HOST'].nil?
args
end |
|
Thanks Jason for improving the MR! Quick response to Matthew's comments:
Understand that pyproject.toml and uv.lock are preferred, but the current behavior for just pyproject.toml is not as one would expect, after having used |
[project]
name = "index-demo"
version = "0.0.0"
requires-python = ">=3.11"
dependencies = ["cowsay>=5", "boltons>=21"]
[tool.uv]
package = false
[[tool.uv.index]]
name = "repo-a"
url = "http://127.0.0.1:9101/simple"
[[tool.uv.index]]
name = "repo-b"
url = "http://127.0.0.1:9102/simple"❯ uv pip install --python .venv --default-index https://pypi.org/simple .
⠸ index-demo==0.0.0 error: Request failed after 3 retries in 7.8s
Caused by: Failed to fetch: `http://127.0.0.1:9101/simple/boltons/`
Caused by: error sending request for url (http://127.0.0.1:9101/simple/boltons/)
Caused by: client error (Connect)
Caused by: tcp connect error
Caused by: Connection refused (os error 61)Where the indexes are not respected is when the command is run outside of the project directory ❯ uv pip install --python ./uv-test/.venv --default-index https://pypi.org/simple ./uv-test
Using Python 3.13.15 environment at: uv-test/.venv
Resolved 3 packages in 142ms
Built index-demo @ file:///Users/mcosgriff/Development/uv-test
Prepared 1 package in 372ms
Installed 3 packages in 3ms
+ boltons==26.1.0
+ cowsay==6.1
+ index-demo==0.0.0 (from file:///Users/mcosgriff/Development/uv-test)Root cause is ours: passing a bare Path 2: Fallback becomes if [ -f "${GEM_PATH}/requirements.txt" ]; then
echo "Installing from requirements.txt via uv pip install"
uv_offline_then_online pip install --python "${VENV_DIR}" ${UV_ARGS} -r "${GEM_PATH}/requirements.txt"
RESULT=$?
elif [ -f "${GEM_PATH}/pyproject.toml" ]; then
echo "Installing from pyproject.toml via uv pip install"
uv_offline_then_online pip install --python "${VENV_DIR}" --project "${GEM_PATH}" ${UV_ARGS} -r "${GEM_PATH}/pyproject.toml"
RESULT=$?
else
echo "ERROR: No requirements.txt, pyproject.toml, or uv.lock found in ${GEM_PATH}"
exit 1
fi |



Adds a new path in uvinstall that attempts to use
uv syncif pyproject.toml is present but not uv.lockDecided to add new path so it preserves the fallback
uv pip installoption.Addresses #3707