Fix add_pip_as_python_dependency not respected with sharded repodata#929
Fix add_pip_as_python_dependency not respected with sharded repodata#929
Conversation
dholth
left a comment
There was a problem hiding this comment.
This is great; I thought we would have to override shards "list of dependencies for package" but apparently we just have to send a boolean to libmamba.
| assert python_records | ||
|
|
||
| pip_in_depends = any( | ||
| dep == "pip" or dep.startswith("pip ") for dep in (python_records[0].depends or []) |
There was a problem hiding this comment.
| dep == "pip" or dep.startswith("pip ") for dep in (python_records[0].depends or []) | |
| dep.startswith("pip") for dep in (python_records[0].depends or []) |
Would be a looser check.
Can it be one or the other? I would kindof expect that the pip dependency is always an exact string?
We could use the sharded def spec_to_package_name(spec: str) -> str: (a simple MatchSpec call) to really
There was a problem hiding this comment.
Hi @dholth, I like the idea to use spec_to_package_name - nice one! I updated the test to use this.
|
It looks like this will need to come in after #924, since we are getting some CI failures. |
Use environment variable and reset_context() instead of monkeypatch.setattr.() Reverts change from commit abb7bed that was intended to fix an AssertionError on Windows but introduced a regression in CI.
…cy_sharded This assertion will help diagnose CI failures by verifying that the context.add_pip_as_python_dependency flag is correctly set after calling reset_context(), ensuring the monkeypatch environment variable is properly applied.
Verify that the python package was loaded with the correct name and subdir. This will help diagnose if there are any issues with package loading or platform matching in the mamba database.
Instead of special-case handling after shard_mentioned_packages(), use the existing 'extra' parameter to include pip when processing python packages and add_pip_as_python_dependency is enabled. This simplifies the code in both BFS and pipelined traversal algorithms, ensuring both produce identical results.
|
pre-commit.ci autofix |
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
|
It looks like libmamba's "add pip as Python dependency" code happens in the parse-json path, which we sidestep in our sharded repodata implementation.
|
Description
Fixes #918 by passing in
add_pip_as_python_dependencyto the db. I also cleaned up a surrounding test to use pytest-mocker instead of unittest.mocker.Assisted by Claude Sonnet 4.6.
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?Add / update outdated documentation?