Skip to content

Skip "*" versions when pinning resolved default deps as constraints - #6744

Merged
matteius merged 2 commits into
pypa:mainfrom
pcbeingused333:fix/resolved-constraints-skip-star-versions
Oct 18, 2026
Merged

matteius merged 2 commits into
pypa:mainfrom
pcbeingused333:fix/resolved-constraints-skip-star-versions

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

The issue

Since 2026.4.0, pipenv lock fails for a Pipfile that has a default package whose markers exclude the current platform, if the Pipfile also has [dev-packages]:

[packages]
requests = "*"
colorama = {version = "*", markers = "sys_platform == 'win32'"}

[dev-packages]
pytest = "*"
$ pipenv lock          # on Linux, pipenv 2026.10.0 / main
pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Invalid requirement:
'colorama*': Expected semicolon (after name with no version specifier) or end
    colorama*
            ^ (from line 2 of /tmp/pipenv-...-requirements/pipenv-...-constraints.txt)

Pipenv locks the skipped default package as {"markers": "sys_platform == 'win32'", "version": "*"}. When it resolves the develop category, get_constraints_from_resolved_deps (added in #6610) turns each locked default entry into a pin with f"{canonical}{version}". For this entry the result is colorama*, which pip rejects when it parses the constraints file.

Bisected with the published releases on the Pipfile above: 2026.2.2 locks; 2026.4.0, 2026.9.1 and 2026.10.0 fail.

The fix

get_constraints_from_resolved_deps now skips entries whose version is *, the same way get_constraints_from_deps already handles *. Such a package wasn't installed on the locking platform, so there's no pin to carry over to the develop resolution.

Testing

  • New TestGetConstraintsFromResolvedDeps.test_skips_wildcard_versions. It failed before the change with {'colorama*', 'normal==1.0'} != {'normal==1.0'}.
  • pytest tests/unit: the only failure is test_manifest_cache.py::TestCorruptionRobustness::test_expires_at_wrong_type_treated_as_miss. It fails intermittently on main too (1 of 3 runs of that file on 81d6b14) and passes when run alone. test_release_tasks.py and test_vendor.py fail to import in both runs because the release and vendoring tools aren't installed.
  • ruff check on the changed files: clean.
  • End to end with the Pipfile above (plus packaging and requests[socks], Python 3.13 on Linux): pipenv lock now succeeds, with colorama locked as before ("version": "*" with its marker). pipenv requirements with no flags, --dev, --hash, --dev --hash, --dev-only and --categories packages,dev-packages all produce files that pip install --dry-run -r accepts (with --require-hashes for the hashed ones).

The checklist

  • Associated issue (none found)
  • A news fragment in the news/ directory (news/0000.bugfix.rst, to be renamed to the PR number)

This PR was prepared with an AI coding assistant (Claude Code), which also wrote the change and the test and ran the checks above.

🤖 Generated with Claude Code

pcbeingused333 and others added 2 commits October 18, 2026 01:56
A default package whose markers exclude the locking platform is locked
as "version": "*". get_constraints_from_resolved_deps turned that into
the constraint "colorama*", which pip rejects, so locking any Pipfile
with such a package and [dev-packages] failed with "Invalid requirement:
'colorama*'" since 2026.4.0. There is no pin to carry over for these
packages, so skip them like get_constraints_from_deps does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matteius
matteius merged commit 26baf63 into pypa:main Oct 18, 2026
22 checks passed
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.

2 participants