Download tasks/swe-next-5a0e26bb0159a67bbbc0/instruction.md from FineEnvs/repo2rlenv-swe-next: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/datasets/FineEnvs/repo2rlenv-swe-next/resolve/a6b1edf56ccadb722f34c40dde05944517fc7efe/tasks/swe-next-5a0e26bb0159a67bbbc0/instruction.md
- Command line
-
hf download hf://datasets/FineEnvs/repo2rlenv-swe-next@a6b1edf56ccadb722f34c40dde05944517fc7efe/tasks/swe-next-5a0e26bb0159a67bbbc0/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/FineEnvs/repo2rlenv-swe-next/resolve/a6b1edf56ccadb722f34c40dde05944517fc7efe/tasks/swe-next-5a0e26bb0159a67bbbc0/instruction.md
Pylock.select() does not support prefer_sdist_predicate argument
When calling Pylock.select() with a prefer_sdist_predicate keyword argument, a TypeError is raised because the method does not accept that parameter.
The expected behavior is that prefer_sdist_predicate should be a callable that takes a normalized package name and returns True if the source distribution should be preferred over available wheels for that package. If no sdist is available for a package, the predicate should not be called and wheel selection should proceed as normal.
Example
from packaging.pylock import Package, PackageSdist, PackageWheel, Pylock
from packaging.tags import sys_tags
from packaging.version import Version
from typing import cast
pylock = Pylock(
lock_version=Version("1.0"),
created_by="some_tool",
packages=[
Package(
name=cast("NormalizedName", "foo"),
sdist=PackageSdist(path="foo-1.0.tar.gz", hashes={"sha256": "abc123"}),
wheels=[
PackageWheel(path="./foo-1.0-py3-none-any.whl", hashes={"sha256": "abc123"})
],
)
],
)
pylock.validate()
def prefer_sdist(name):
return True # always prefer source distributions
result = list(pylock.select(prefer_sdist_predicate=prefer_sdist))
Running this raises:
TypeError: Pylock.select() got an unexpected keyword argument 'prefer_sdist_predicate'
Expected behavior
Pylock.select() should accept a prefer_sdist_predicate callable. When the predicate returns True for a given package name and an sdist is available, the sdist should be yielded instead of a compatible wheel. If no sdist is available for a package, the predicate should not be called and normal wheel selection should apply. When no wheels exist and the predicate returns False, the sdist should still be selected as a fallback.
Actual behavior
Pylock.select() raises TypeError: Pylock.select() got an unexpected keyword argument 'prefer_sdist_predicate' regardless of the arguments passed.
Work in /workspace. Submit your fix in the existing Python source files under src/packaging. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.