renovate/lib/modules/manager/pip-compile
renovate[bot] eb8c08079e
chore(deps): update typescript-eslint monorepo to v8 (major) (#30750)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-14 10:33:02 +00:00
..
__fixtures__ feat(manager/pip-compile): Change fileMatch behaviour to target pip-compile output files (#26858) 2024-02-13 13:53:23 +00:00
artifacts.spec.ts feat(pip-compile): Provide credentials for registries in all input files (#28959) 2024-06-04 16:33:08 +00:00
artifacts.ts feat(pip-compile): Provide credentials for registries in all input files (#28959) 2024-06-04 16:33:08 +00:00
common.spec.ts feat(pip-compile): Treat .txt files as pip_requirements files (#29491) 2024-06-06 17:08:46 +00:00
common.ts feat(pip-compile): Treat .txt files as pip_requirements files (#29491) 2024-06-06 17:08:46 +00:00
extract.spec.ts fix!: normalize Python depName in every manager (#27733) 2024-07-25 15:28:16 +02:00
extract.ts chore(deps): update typescript-eslint monorepo to v8 (major) (#30750) 2024-08-14 10:33:02 +00:00
index.ts feat(manager/pip-compile): Change fileMatch behaviour to target pip-compile output files (#26858) 2024-02-13 13:53:23 +00:00
readme.md feat(manager/pip-compile): extract Python version from lock files (#29145) 2024-05-24 06:09:19 +00:00
types.ts fix(manager/pip-compile): allow --all-extras arg (#27637) 2024-03-01 16:00:09 +00:00
utils.spec.ts feat(manager/pip-compile): Allow paths relative to repository root (#27272) 2024-02-20 17:45:15 +00:00
utils.ts feat(manager/pip-compile): Allow paths relative to repository root (#27272) 2024-02-20 17:45:15 +00:00

readme.md

Due to limited functionality, the pip-compile manager should be considered in an "alpha" stage, which means it's not ready for production use for the majority of end users. We welcome feedback and bug reports!

The current implementation has some limitations. Read the full document before you start using the pip-compile manager.

Non-configured fileMatch

The pip-compile manager has an empty array for default fileMatch, meaning it won't match any files ever by default. You can "activate" the manager by specifying a fileMatch pattern such as:

{
  "pip-compile": {
    "fileMatch": ["(^|/)requirements\\.txt$"]
  }
}

pip-compile reads the output files to extract the arguments passed to the original command, as such the fileMatch must be configured for *.txt files and not *.in.

Assumption of header with a command

As Renovate matches a pip-compile output file it will extract original command that was used to create it from header in this file. Because of that pip-compile manager poses restrictions on how this file is generated:

  • Use default header generation, don't use --no-header option.
  • Pass all source files explicitly.

In turn pip-compile manager will find all source files and parse them as package files using their respective managers.

The following files are currently supported:

Source filename Manager
setup.py pip_setup
*.in pip_requirements

Example header:

#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    pip-compile --no-emit-index-url --output-file=requirements.txt requirements.in
#

Conflicts with other managers

Because pip-compile will update source files with their associated manager you should disable them to avoid running these managers twice.

{
  "pip_requirements": {
    "enabled": false
  },
  "pip_setup": {
    "enabled": false
  }
}

Configuration of Python version

By default Renovate extracts Python version from the header. To get Renovate to use another version of Python, add a constraints` rule to the Renovate config:

{
  "constraints": {
    "python": "==3.7"
  }
}

pip-compile arguments

Renovate reads the requirements.txt file and extracts these pip-compile arguments:

  • source files as positional arguments
  • --output-file

All other allowed pip-compile arguments will be passed over without modification.

Transitive / indirect dependencies

This manager detects dependencies that only appear in lock files. They are disabled by default but can be forced to enable by vulnerability alerts. They will be upgraded with --upgrade-package option.