Skip to content

Compatibility with renovate #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sathieu opened this issue Feb 27, 2025 · 4 comments
Open

Compatibility with renovate #91

sathieu opened this issue Feb 27, 2025 · 4 comments

Comments

@sathieu
Copy link

sathieu commented Feb 27, 2025

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
#
@juftin
Copy link
Owner

juftin commented Feb 28, 2025

The header of hatch-pip-compile is required for the plugin to determine whether or not a lockfile is up to date, unfortunately it's not something I'm able to remove.

FWIW, it would be difficult to extract the command that the plugin runs as well - instead of running a generic pip-compile ... / uv pip compile command, the plugin actually creates a temporary requirements.in file for a given hatch environment's dependencies and runs "compile" on that

@sathieu
Copy link
Author

sathieu commented Feb 28, 2025

OK. I've created renovatebot/renovate#34554.

@sathieu
Copy link
Author

sathieu commented Mar 6, 2025

Nevermind, I migrated to uv.

@sathieu sathieu closed this as completed Mar 6, 2025
@sathieu
Copy link
Author

sathieu commented Mar 7, 2025

Reopening, uv is not completely integrated with hatch pypa/hatch#1886

@sathieu sathieu reopened this Mar 7, 2025
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

No branches or pull requests

2 participants