Repository navigation
Description
Describe the bug
When Pipfile.lock contains a PEP 440 arbitrary-equality pin ("version": "===0.4.6"), cyclonedx-py pipenv strips only the first two characters and emits "version": "=0.4.6" and "purl": "pkg:pypi/colorama@%3D0.4.6". By contrast, cyclonedx-py requirements parses colorama===0.4.6 as version "0.4.6" and PURL "pkg:pypi/[email protected]".
pipenv lock writes "version": "===..." into Pipfile.lock when a Pipfile entry pinned with === has an environment marker that does not match the locking host (for example locking a cross-platform Pipfile on Linux with a sys_platform == 'win32' dependency).
To Reproduce
On a non-Windows machine with pipenv and cyclonedx-bom installed:
mkdir repro && cd repro
cat > Pipfile <<'EOF'
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
colorama = {version = "===0.4.6", markers = "sys_platform == 'win32'"}
EOF
pipenv lock
cyclonedx-py pipenv .pipenv lock generates a Pipfile.lock entry with "version": "===0.4.6".
Expected behavior
cyclonedx-py pipenv should emit "version": "0.4.6" and "purl": "pkg:pypi/[email protected]", matching cyclonedx-py requirements.
Screenshots or output-paste
{
"bom-ref": "colorama===0.4.6",
"externalReferences": [
{
"comment": "from implicit index: pypi",
"hashes": [
{
"alg": "SHA-256",
"content": "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"
},
{
"alg": "SHA-256",
"content": "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
}
],
"type": "distribution",
"url": "https://pypi.org/simple/colorama/"
}
],
"name": "colorama",
"properties": [
{
"name": "cdx:pipenv:category",
"value": "default"
}
],
"purl": "pkg:pypi/colorama@%3D0.4.6",
"type": "library",
"version": "=0.4.6"
}Environment
- cyclonedx-py version:
9.0.0(also reproduced onmaincommit087a93338905b6c3b4169cb8c35721b442c23ae4, withpipenv2026.11.0) - Python version:
Python 3.11.2 - OS:
Debian GNU/Linux 12
Additional context
In cyclonedx_py/_internal/pipenv.py, _make_bom computes version=package_data['version'][2:], which assumes every locked version prefix is two characters (==) rather than three (===).
Contribution
- I am willing to provide a fix
- I will wait until somebody else fixes it
Credit: https://ucsbplse.github.io/
Activity
pinsara23 commentedon Nov 26, 2026
Hi, I'd like to work on this. My plan: replace the [2:] slice in _make_bom (cyclonedx_py/_internal/pipenv.py) so it strips the full ==/=== prefix, and add a pipenv test fixture with an arbitrary equality pin plus updated snapshots. I'll open a PR within the next few days. Could this be assigned to me?
jkowalleck commentedon Nov 26, 2026
there is a PR already
===operator from locked versions #1156feal free to collaborate with the respective PR author.
pinsara23 commentedon Nov 26, 2026
Thanks! I'll leave this to #1156 and look at #1152 instead.
jkowalleck commentedon Nov 30, 2026
fixed per https://github.com/CycloneDX/cyclonedx-python/releases/tag/v9.0.1