Skip to content

Compatibility with renovate #91

Description

@sathieu

Renovate has support for pip-compile.

However, this support is based on requirements.txt parsing to retrieve the pip-compile command options.

This fails for a file with the following header:

#
# This file is autogenerated by hatch-pip-compile with Python 3.13
#
# - kubernetes
# - pydantic
# - pydantic-settings
# - pygit2
# - ruamel-yaml
#

With the error:

 WARN: pip-compile error (repository=kubitus-project/python-kubitus)
       "fileMatch": "requirements.txt",
       "errorMessage": "Failed to extract command from header in requirements.txt #\n# This file is autogenerated by hatch-pip-compile with Python 3.13\n#\n# - kubernetes\n# - pydantic\n# - pydantic-settings\n# - pygit2\n# - ruamel-yaml\n#\n\nannotated-types==0.7.0\n    # via pydantic\ncachetools==5.5.2\n    # via google-auth\ncertifi==2025.1.31\n    # via\n    #   kubernetes\n    #   requests\ncffi==1.17.1\n    # via pygit2\ncharset-normalizer==3.4.1\n    # via requests\ndurationpy==0.9\n    # via kubernetes\ngoogle-auth==2.38.0\n    # via kubernetes\nidna==3.10\n    # via requests\nkubernetes==32.0.1\n    # via hatch.envs.default\noauthlib==3.2.2\n    # via\n    #   kubernetes\n    #   requests-oauthlib\npyasn1==0.6.1\n    # via\n    #   pyasn1-modules\n    #   rsa\npyasn1-modules==0.4.1\n    # via google-auth\npycparser==2.22\n    # via cffi\npydantic==2.10.6\n    # via\n    #   hatch.envs.default\n    #   pydantic-settings\npydantic-core==2.27.2\n    # via pydantic\npydantic-settings==2.8.0\n    # via hatch.envs.default\npygit2==1.17.0\n    # via hatch.envs.default\npython-dateutil==2.9.0.post0\n    # via kubernetes\npython-dotenv==1.0.1\n    # via pydantic-settings\npyyaml==6.0.2\n    # via kubernetes\nrequests==2.32.3\n    # via\n    #   kubernetes\n    #   requests-oauthlib\nrequests-oauthlib==2.0.0\n    # via kubernetes\nrsa==4.9\n    # via google-auth\nruamel-yaml==0.18.10\n    # via hatch.envs.default\nsix==1.17.0\n    # via\n    #   kubernetes\n    #   python-dateutil\ntyping-extensions==4.12.2\n    # via\n    #   pydantic\n    #   pydantic-core\nurllib3==2.3.0\n    # via\n    #   kubernetes\n    #   requests\nwebsocket-client==1.8.0\n    # via kubernetes\n"

Here is the used regex:

export const constraintLineRegex = regEx(
  /^(#.*?\r?\n)+# {4}(?<command>\S*)(?<arguments> .*?)?\r?\n/,
);

This would work if hatch-pip-compile would use the following header:

#
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
#    pip-compile
#

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions