Skip to content

Pypi replacementVersion not working without == #35824

Open
@rarkins

Description

@rarkins

Discussed in #35395

Originally posted by sichapman April 15, 2025

How are you running Renovate?

Self-hosted Renovate

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

GitLab

Please tell us more about your question or problem

I have a basic replacement packageRule:

{
      "matchPackageNames": ["safety"],
      "matchDatasources": ["pypi"],
      "replacementName": "pip-audit",
      "replacementVersion": "2.9.0"
}

But Renovate fails to create the branch. The debug logs just have a generic error message (see logs section) but I did notice this:

"branchesInformation": [
         {
           "branchName": "renovate/safety-replacement",
           "prNo": null,
           "prTitle": "Replace dependency safety with pip-audit",
           "result": "error",
           "upgrades": [
             {
               "datasource": "pypi",
               "depName": "safety",
               "displayPending": "",
               "fixedVersion": "2.3.5",
               "currentVersion": "2.3.5",
               "currentValue": "==2.3.5",
               "newValue": "2.9.0",
               "packageFile": "requirements_test.in",
               "updateType": "replacement",
               "packageName": "safety"
             }
           ]
         },

Specifically "newValue": "2.9.0", I think should be "newValue": "==2.9.0",? If I change replacementVersion in the packageRule to have == then it does all work as expected, but that feels more of a workaround than how I should be expected to do it?

Using pip-compile manager if that makes a difference

Logs (if relevant)

Logs
DEBUG: manager.getUpdatedPackageFiles() reuseExistingBranch=false (repository=renovate-reproductions/35395, branch=renovate/safety-replacement)
DEBUG: depName not found in string to replace (repository=renovate-reproductions/35395, branch=renovate/safety-replacement)
       "stringToReplace": "2.9.0",
       "depName": "safety",
       "depNameTemplate": undefined
DEBUG: Starting search at index 0 (repository=renovate-reproductions/35395, packageFile=requirements.txt, branch=renovate/safety-replacement)
       "depName": "safety"
DEBUG: Found depName at index 0 (repository=renovate-reproductions/35395, packageFile=requirements.txt, branch=renovate/safety-replacement)
       "depName": "safety"
DEBUG: Found currentValue at index 9 (repository=renovate-reproductions/35395, packageFile=requirements.txt, branch=renovate/safety-replacement)
       "currentValue": "==3.5.0"
DEBUG: depName mismatch (repository=renovate-reproductions/35395, packageFile=requirements.txt, branch=renovate/safety-replacement)
       "manager": "pip_requirements",
       "currentDepName": "safety",
       "newDepName": "pip-audit2.9.0"
 WARN: Error updating branch: update failure (repository=renovate-reproductions/35395, branch=renovate/safety-replacement)

Reproduction forked to https://github.com/renovate-reproductions/35395

Metadata

Metadata

Assignees

No one assigned

    Labels

    manager:pip_requirementspip requirements.txtpriority-3-mediumDefault priority, "should be done" but isn't prioritised ahead of others

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions