dependabot-python 0.291.0 → 0.293.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/python/file_parser.rb +62 -5
- data/lib/dependabot/python/file_updater/requirement_replacer.rb +15 -0
- data/lib/dependabot/python/language.rb +60 -3
- data/lib/dependabot/python/language_version_manager.rb +9 -0
- data/lib/dependabot/python/package_manager.rb +21 -20
- data/lib/dependabot/python/update_checker/poetry_version_resolver.rb +12 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b25ebaf8e9c7ec713cdc0ed55d0447bc0550e6889f1b948626514eb956da21fe
|
4
|
+
data.tar.gz: 5fa5ef854bd4291ace811e78ce5e48dd33fa34a6dbccc3df13ca993fd67def1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06decf5a991d84e80b454307fdb269927619e24f295a5c759b5403e7cc036d6f143a87d6b0718fb3bcfb9460d625fc3a13acf8aa8bf2c7054205afb25ca1436
|
7
|
+
data.tar.gz: cd14d822f9f00215a89f0baa2cbcff208e88d04c5c72d6dc18759e6caf974b0f1112625bc37305ebc029c188bc26616d836ad5dc1ca739f8dc7dee4e640679ff
|
@@ -21,6 +21,7 @@ module Dependabot
|
|
21
21
|
require_relative "file_parser/pipfile_files_parser"
|
22
22
|
require_relative "file_parser/pyproject_files_parser"
|
23
23
|
require_relative "file_parser/setup_file_parser"
|
24
|
+
require_relative "file_parser/python_requirement_parser"
|
24
25
|
|
25
26
|
DEPENDENCY_GROUP_KEYS = [
|
26
27
|
{
|
@@ -217,9 +218,17 @@ module Dependabot
|
|
217
218
|
language_version_manager.python_version
|
218
219
|
end
|
219
220
|
|
221
|
+
sig { returns(String) }
|
222
|
+
def python_command_version
|
223
|
+
language_version_manager.installed_version
|
224
|
+
end
|
225
|
+
|
220
226
|
sig { returns(T.nilable(Ecosystem::VersionManager)) }
|
221
227
|
def language
|
222
|
-
Language.new(
|
228
|
+
Language.new(
|
229
|
+
detected_version: python_raw_version,
|
230
|
+
raw_version: python_command_version
|
231
|
+
)
|
223
232
|
end
|
224
233
|
|
225
234
|
def requirement_files
|
@@ -293,10 +302,58 @@ module Dependabot
|
|
293
302
|
|
294
303
|
def blocking_marker?(dep)
|
295
304
|
return false if dep["markers"] == "None"
|
296
|
-
return true if dep["markers"].include?("<")
|
297
|
-
return false if dep["markers"].include?(">")
|
298
305
|
|
299
|
-
dep["
|
306
|
+
marker = dep["markers"]
|
307
|
+
version = python_raw_version
|
308
|
+
|
309
|
+
if marker.include?("python_version")
|
310
|
+
!marker_satisfied?(marker, version)
|
311
|
+
else
|
312
|
+
return true if dep["markers"].include?("<")
|
313
|
+
return false if dep["markers"].include?(">")
|
314
|
+
|
315
|
+
dep["requirement"]&.include?("<")
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
def marker_satisfied?(marker, python_version)
|
320
|
+
conditions = marker.split(/\s+(and|or)\s+/)
|
321
|
+
|
322
|
+
# Explicitly define the type of result as T::Boolean
|
323
|
+
result = T.let(evaluate_condition(conditions.shift, python_version), T::Boolean)
|
324
|
+
|
325
|
+
until conditions.empty?
|
326
|
+
operator = conditions.shift
|
327
|
+
next_condition = conditions.shift
|
328
|
+
next_result = evaluate_condition(next_condition, python_version)
|
329
|
+
|
330
|
+
result = if operator == "and"
|
331
|
+
result && next_result
|
332
|
+
else
|
333
|
+
result || next_result
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
result
|
338
|
+
end
|
339
|
+
|
340
|
+
def evaluate_condition(condition, python_version)
|
341
|
+
operator, version = condition.match(/([<>=!]=?)\s*"?([\d.]+)"?/)&.captures
|
342
|
+
|
343
|
+
case operator
|
344
|
+
when "<"
|
345
|
+
Dependabot::Python::Version.new(python_version) < Dependabot::Python::Version.new(version)
|
346
|
+
when "<="
|
347
|
+
Dependabot::Python::Version.new(python_version) <= Dependabot::Python::Version.new(version)
|
348
|
+
when ">"
|
349
|
+
Dependabot::Python::Version.new(python_version) > Dependabot::Python::Version.new(version)
|
350
|
+
when ">="
|
351
|
+
Dependabot::Python::Version.new(python_version) >= Dependabot::Python::Version.new(version)
|
352
|
+
when "=="
|
353
|
+
Dependabot::Python::Version.new(python_version) == Dependabot::Python::Version.new(version)
|
354
|
+
else
|
355
|
+
false
|
356
|
+
end
|
300
357
|
end
|
301
358
|
|
302
359
|
def setup_file_dependencies
|
@@ -337,7 +394,7 @@ module Dependabot
|
|
337
394
|
end
|
338
395
|
|
339
396
|
def pipcompile_in_file
|
340
|
-
requirement_files.any? { |f| f.end_with?(
|
397
|
+
requirement_files.any? { |f| f.name.end_with?(PipCompilePackageManager::MANIFEST_FILENAME) }
|
341
398
|
end
|
342
399
|
|
343
400
|
def pipenv_files
|
@@ -14,6 +14,8 @@ module Dependabot
|
|
14
14
|
class RequirementReplacer
|
15
15
|
PACKAGE_NOT_FOUND_ERROR = "PackageNotFoundError"
|
16
16
|
|
17
|
+
CERTIFICATE_VERIFY_FAILED = /CERTIFICATE_VERIFY_FAILED/
|
18
|
+
|
17
19
|
def initialize(content:, dependency_name:, old_requirement:,
|
18
20
|
new_requirement:, new_hash_version: nil, index_urls: nil)
|
19
21
|
@content = content
|
@@ -153,6 +155,8 @@ module Dependabot
|
|
153
155
|
args: args
|
154
156
|
)
|
155
157
|
rescue SharedHelpers::HelperSubprocessFailed => e
|
158
|
+
requirement_error_handler(e)
|
159
|
+
|
156
160
|
raise unless e.message.include?("PackageNotFoundError")
|
157
161
|
|
158
162
|
next
|
@@ -193,6 +197,17 @@ module Dependabot
|
|
193
197
|
req1&.split(",")&.map { |r| r.gsub(/\s/, "") }&.sort ==
|
194
198
|
req2&.split(",")&.map { |r| r.gsub(/\s/, "") }&.sort
|
195
199
|
end
|
200
|
+
|
201
|
+
public
|
202
|
+
|
203
|
+
def requirement_error_handler(error)
|
204
|
+
Dependabot.logger.warn(error.message)
|
205
|
+
|
206
|
+
return unless error.message.match?(CERTIFICATE_VERIFY_FAILED)
|
207
|
+
|
208
|
+
msg = "Error resolving dependency."
|
209
|
+
raise DependencyFileNotResolvable, msg
|
210
|
+
end
|
196
211
|
end
|
197
212
|
end
|
198
213
|
end
|
@@ -11,10 +11,67 @@ module Dependabot
|
|
11
11
|
|
12
12
|
class Language < Dependabot::Ecosystem::VersionManager
|
13
13
|
extend T::Sig
|
14
|
+
# These versions should match the versions specified at the top of `python/Dockerfile`
|
15
|
+
PYTHON_3_13 = "3.13"
|
16
|
+
PYTHON_3_12 = "3.12"
|
17
|
+
PYTHON_3_11 = "3.11"
|
18
|
+
PYTHON_3_10 = "3.10"
|
19
|
+
PYTHON_3_9 = "3.9"
|
20
|
+
PYTHON_3_8 = "3.8"
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
DEPRECATED_VERSIONS = T.let([Version.new(PYTHON_3_8)].freeze, T::Array[Dependabot::Version])
|
23
|
+
|
24
|
+
# Keep versions in ascending order
|
25
|
+
SUPPORTED_VERSIONS = T.let([
|
26
|
+
Version.new(PYTHON_3_9),
|
27
|
+
Version.new(PYTHON_3_10),
|
28
|
+
Version.new(PYTHON_3_11),
|
29
|
+
Version.new(PYTHON_3_12),
|
30
|
+
Version.new(PYTHON_3_13)
|
31
|
+
].freeze, T::Array[Dependabot::Version])
|
32
|
+
|
33
|
+
sig do
|
34
|
+
params(
|
35
|
+
detected_version: String,
|
36
|
+
raw_version: T.nilable(String),
|
37
|
+
requirement: T.nilable(Requirement)
|
38
|
+
).void
|
39
|
+
end
|
40
|
+
def initialize(detected_version:, raw_version: nil, requirement: nil)
|
41
|
+
super(
|
42
|
+
name: LANGUAGE,
|
43
|
+
detected_version: major_minor_version(detected_version),
|
44
|
+
version: raw_version ? Version.new(raw_version) : nil,
|
45
|
+
deprecated_versions: DEPRECATED_VERSIONS,
|
46
|
+
supported_versions: SUPPORTED_VERSIONS,
|
47
|
+
requirement: requirement,
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
sig { override.returns(T::Boolean) }
|
52
|
+
def deprecated?
|
53
|
+
return false unless detected_version
|
54
|
+
return false if unsupported?
|
55
|
+
return false unless Dependabot::Experiments.enabled?(:python_3_8_deprecation_warning)
|
56
|
+
|
57
|
+
deprecated_versions.include?(detected_version)
|
58
|
+
end
|
59
|
+
|
60
|
+
sig { override.returns(T::Boolean) }
|
61
|
+
def unsupported?
|
62
|
+
return false unless detected_version
|
63
|
+
return false unless Dependabot::Experiments.enabled?(:python_3_8_unsupported_error)
|
64
|
+
|
65
|
+
supported_versions.all? { |supported| supported > detected_version }
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
sig { params(version: String).returns(Dependabot::Python::Version) }
|
71
|
+
def major_minor_version(version)
|
72
|
+
major_minor = T.let(T.must(Version.new(version).segments[0..1]&.join(".")), String)
|
73
|
+
|
74
|
+
Version.new(major_minor)
|
18
75
|
end
|
19
76
|
end
|
20
77
|
end
|
@@ -9,6 +9,7 @@ module Dependabot
|
|
9
9
|
class LanguageVersionManager
|
10
10
|
# This list must match the versions specified at the top of `python/Dockerfile`
|
11
11
|
PRE_INSTALLED_PYTHON_VERSIONS = %w(
|
12
|
+
3.13.1
|
12
13
|
3.12.7
|
13
14
|
3.11.9
|
14
15
|
3.10.15
|
@@ -29,6 +30,14 @@ module Dependabot
|
|
29
30
|
)
|
30
31
|
end
|
31
32
|
|
33
|
+
def installed_version
|
34
|
+
# Use `pyenv exec` to query the active Python version
|
35
|
+
output, _status = SharedHelpers.run_shell_command("pyenv exec python --version")
|
36
|
+
version = output.strip.split.last # Extract the version number (e.g., "3.13.1")
|
37
|
+
|
38
|
+
version
|
39
|
+
end
|
40
|
+
|
32
41
|
def python_major_minor
|
33
42
|
@python_major_minor ||= T.must(Python::Version.new(python_version).segments[0..1]).join(".")
|
34
43
|
end
|
@@ -31,11 +31,11 @@ module Dependabot
|
|
31
31
|
end
|
32
32
|
def initialize(raw_version, requirement = nil)
|
33
33
|
super(
|
34
|
-
NAME,
|
35
|
-
Version.new(raw_version),
|
36
|
-
|
37
|
-
|
38
|
-
requirement,
|
34
|
+
name: NAME,
|
35
|
+
version: Version.new(raw_version),
|
36
|
+
deprecated_versions: DEPRECATED_VERSIONS,
|
37
|
+
supported_versions: SUPPORTED_VERSIONS,
|
38
|
+
requirement: requirement,
|
39
39
|
)
|
40
40
|
end
|
41
41
|
|
@@ -69,11 +69,11 @@ module Dependabot
|
|
69
69
|
end
|
70
70
|
def initialize(raw_version, requirement = nil)
|
71
71
|
super(
|
72
|
-
NAME,
|
73
|
-
Version.new(raw_version),
|
74
|
-
|
75
|
-
|
76
|
-
requirement,
|
72
|
+
name: NAME,
|
73
|
+
version: Version.new(raw_version),
|
74
|
+
deprecated_versions: DEPRECATED_VERSIONS,
|
75
|
+
supported_versions: SUPPORTED_VERSIONS,
|
76
|
+
requirement: requirement,
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
@@ -92,6 +92,7 @@ module Dependabot
|
|
92
92
|
extend T::Sig
|
93
93
|
|
94
94
|
NAME = "pip-compile"
|
95
|
+
MANIFEST_FILENAME = ".in"
|
95
96
|
|
96
97
|
SUPPORTED_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])
|
97
98
|
|
@@ -105,11 +106,11 @@ module Dependabot
|
|
105
106
|
end
|
106
107
|
def initialize(raw_version, requirement = nil)
|
107
108
|
super(
|
108
|
-
NAME,
|
109
|
-
Version.new(raw_version),
|
110
|
-
|
111
|
-
|
112
|
-
requirement,
|
109
|
+
name: NAME,
|
110
|
+
version: Version.new(raw_version),
|
111
|
+
deprecated_versions: DEPRECATED_VERSIONS,
|
112
|
+
supported_versions: SUPPORTED_VERSIONS,
|
113
|
+
requirement: requirement,
|
113
114
|
)
|
114
115
|
end
|
115
116
|
|
@@ -144,11 +145,11 @@ module Dependabot
|
|
144
145
|
end
|
145
146
|
def initialize(raw_version, requirement = nil)
|
146
147
|
super(
|
147
|
-
NAME,
|
148
|
-
Version.new(raw_version),
|
149
|
-
|
150
|
-
|
151
|
-
requirement,
|
148
|
+
name: NAME,
|
149
|
+
version: Version.new(raw_version),
|
150
|
+
deprecated_versions: DEPRECATED_VERSIONS,
|
151
|
+
supported_versions: SUPPORTED_VERSIONS,
|
152
|
+
requirement: requirement,
|
152
153
|
)
|
153
154
|
end
|
154
155
|
|
@@ -369,6 +369,12 @@ module Dependabot
|
|
369
369
|
server504: /504 Server Error/
|
370
370
|
}.freeze, T::Hash[T.nilable(String), Regexp])
|
371
371
|
|
372
|
+
# invalid configuration in pyproject.toml
|
373
|
+
POETRY_VIRTUAL_ENV_CONFIG = %r{pypoetry/virtualenvs(.|\n)*list index out of range}
|
374
|
+
|
375
|
+
# error related to local project as dependency in pyproject.toml
|
376
|
+
ERR_LOCAL_PROJECT_PATH = /Path (?<path>.*) for (?<dep>.*) does not exist/
|
377
|
+
|
372
378
|
sig do
|
373
379
|
params(
|
374
380
|
dependencies: Dependabot::Dependency,
|
@@ -418,6 +424,12 @@ module Dependabot
|
|
418
424
|
|
419
425
|
raise DependencyFileNotResolvable, error.message if error.message.match(PYTHON_RANGE_NOT_SATISFIED)
|
420
426
|
|
427
|
+
if error.message.match(POETRY_VIRTUAL_ENV_CONFIG) || error.message.match(ERR_LOCAL_PROJECT_PATH)
|
428
|
+
msg = "Error while resolving pyproject.toml file"
|
429
|
+
|
430
|
+
raise DependencyFileNotResolvable, msg
|
431
|
+
end
|
432
|
+
|
421
433
|
SERVER_ERROR_CODES.each do |(_error_codes, error_regex)|
|
422
434
|
next unless error.message.match?(error_regex)
|
423
435
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-python
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.293.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.293.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.293.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,7 +290,7 @@ licenses:
|
|
290
290
|
- MIT
|
291
291
|
metadata:
|
292
292
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
293
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
293
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.293.0
|
294
294
|
post_install_message:
|
295
295
|
rdoc_options: []
|
296
296
|
require_paths:
|
@@ -306,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
306
|
- !ruby/object:Gem::Version
|
307
307
|
version: 3.1.0
|
308
308
|
requirements: []
|
309
|
-
rubygems_version: 3.5.
|
309
|
+
rubygems_version: 3.5.22
|
310
310
|
signing_key:
|
311
311
|
specification_version: 4
|
312
312
|
summary: Provides Dependabot support for Python
|