From cfc976db426b91e1a381f07efdbeabb90c75d0ad Mon Sep 17 00:00:00 2001
From: deniseunt <48535838+deniseunt@users.noreply.github.com>
Date: Thu, 15 Jun 2023 14:45:09 -0500
Subject: [PATCH] =?UTF-8?q?feat(manager/pip-requirements):=20Amend=20fileM?=
 =?UTF-8?q?atch=20regex=20to=20match=20common=20=E2=80=A6=20(#22778)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
---
 docs/usage/configuration-options.md            | 2 +-
 docs/usage/python.md                           | 3 +++
 lib/modules/manager/pip_requirements/index.ts  | 2 +-
 lib/modules/manager/pip_requirements/readme.md | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md
index 53232f4c4b..3f725b46e1 100644
--- a/docs/usage/configuration-options.md
+++ b/docs/usage/configuration-options.md
@@ -2832,7 +2832,7 @@ Defaults to `true`.
 
 ## python
 
-Currently the only Python package manager is `pip` - specifically for `requirements.txt` and `requirements.pip` files - so adding any config to this `python` object is essentially the same as adding it to the `pip_requirements` object instead.
+Currently the only Python package manager is `pip` - specifically for `requirements.txt` and `requirements.pip` files, or any file that matches the pattern `requirements-*.(txt|pip)` - so adding any config to this `python` object is essentially the same as adding it to the `pip_requirements` object instead.
 
 ## rangeStrategy
 
diff --git a/docs/usage/python.md b/docs/usage/python.md
index 2bc96d3b85..5c26884db9 100644
--- a/docs/usage/python.md
+++ b/docs/usage/python.md
@@ -26,6 +26,9 @@ Legacy versions with the `===` prefix are ignored.
 ## Alternative file names
 
 For the `pip_requirements` manager, the default file matching regex for `requirements.txt` follows common file name conventions.
+
+It will match `requirements.txt` and `requirements.pip`, and any file in the format `requirements-*.txt` or `requirements-*.pip`, to allow for common filename patterns such as `requirements-dev.txt`.
+
 But Renovate may not find all your files.
 
 You can tell Renovate where to find your file(s) by setting your own `fileMatch` regex:
diff --git a/lib/modules/manager/pip_requirements/index.ts b/lib/modules/manager/pip_requirements/index.ts
index 4fe319227f..6140bdd15f 100644
--- a/lib/modules/manager/pip_requirements/index.ts
+++ b/lib/modules/manager/pip_requirements/index.ts
@@ -8,7 +8,7 @@ export { extractPackageFile } from './extract';
 export const language: ProgrammingLanguage = 'python';
 
 export const defaultConfig = {
-  fileMatch: ['(^|/)([\\w-]*)requirements\\.(txt|pip)$'],
+  fileMatch: ['(^|/)[\\w-]*requirements(-\\w+)?\\.(txt|pip)$'],
 };
 
 export const supportedDatasources = [PypiDatasource.id, GitTagsDatasource.id];
diff --git a/lib/modules/manager/pip_requirements/readme.md b/lib/modules/manager/pip_requirements/readme.md
index 33bf37c804..5c89d80660 100644
--- a/lib/modules/manager/pip_requirements/readme.md
+++ b/lib/modules/manager/pip_requirements/readme.md
@@ -1 +1 @@
-Supports `requirements.txt` and `requirements.pip` files. The default file pattern is fairly flexible in an attempt to catch similarly named ones too but may be extended/changed.
+Supports `requirements.txt` and `requirements.pip` files. The default file pattern is fairly flexible in an attempt to catch similarly named ones too (eg `requirements-*.txt` and `requirements-*.pip`) but may be extended/changed.
-- 
GitLab