dependabot-uv 0.403.0 → 0.404.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6dcf34decd8b9433312858837acc80f5dd90c0141b9449749a396f8d5e629ac6
|
|
4
|
+
data.tar.gz: 6bf1c71aefe81d0e4faac96383d50c49c683e356b955f238dcacdd555fbf930a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 691a6b566963d5d7c638a566e2a7c78d73a404d9cbfdad8ac9fc3cfae761c062be45d05e95d091f28f74d6a65235e6cc42de76cd58b78e8d275e8cc189e46966
|
|
7
|
+
data.tar.gz: e2761b00c7bbee7f4d6c45209daea41302d8ea75e1991defdaf7f903d4140aa758238a2199f87cdc56ef5958ea6066f06621b0bac95337693e1b53809cd30b94
|
data/helpers/requirements.txt
CHANGED
|
@@ -9,7 +9,7 @@ plette==2.2.1
|
|
|
9
9
|
poetry==2.5.1
|
|
10
10
|
# TODO: Replace 3p package `tomli` with 3.11's new stdlib `tomllib` once we drop support for Python 3.10.
|
|
11
11
|
tomli==2.4.1
|
|
12
|
-
uv==0.13.
|
|
12
|
+
uv==0.13.7
|
|
13
13
|
|
|
14
14
|
# Some dependencies will only install if Cython is present
|
|
15
15
|
Cython==3.3.0
|
|
@@ -9,6 +9,7 @@ require "dependabot/uv/file_parser"
|
|
|
9
9
|
require "dependabot/uv/requirement"
|
|
10
10
|
require "dependabot/errors"
|
|
11
11
|
require "dependabot/uv/name_normaliser"
|
|
12
|
+
require "dependabot/uv/sources_table"
|
|
12
13
|
require "dependabot/python/file_parser/pep_dependency"
|
|
13
14
|
require "dependabot/python/file_parser/poetry_lock"
|
|
14
15
|
require "dependabot/python/file_parser/pyproject_document"
|
|
@@ -92,6 +93,7 @@ module Dependabot
|
|
|
92
93
|
unresolvable_sources = PyprojectDocument.from_file(pyproject_file)
|
|
93
94
|
.unresolvable_uv_source_names
|
|
94
95
|
.map { |name| normalise(name) }
|
|
96
|
+
git_tag_sources = SourcesTable.writable_for(pyproject_file)
|
|
95
97
|
|
|
96
98
|
parse_pep621_pep735_dependencies(pyproject_file).each do |dep|
|
|
97
99
|
# If a requirement has a `<` or `<=` marker then updating it is
|
|
@@ -100,17 +102,16 @@ module Dependabot
|
|
|
100
102
|
|
|
101
103
|
next if unresolvable_sources.include?(normalise(dep.name))
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
requirement_value = dep.requirement == "" ? "*" : dep.requirement
|
|
105
|
+
git_source = git_source_for(git_tag_sources, dep.name)
|
|
105
106
|
|
|
106
107
|
dependencies <<
|
|
107
108
|
Dependency.new(
|
|
108
109
|
name: normalised_name(dep.name, dep.extras),
|
|
109
110
|
version: dep.version&.include?("*") ? nil : dep.version,
|
|
110
111
|
requirements: [{
|
|
111
|
-
requirement:
|
|
112
|
+
requirement: requirement_for(dep.requirement, git_source),
|
|
112
113
|
file: Pathname.new(dep.file).cleanpath.to_path,
|
|
113
|
-
source:
|
|
114
|
+
source: git_source,
|
|
114
115
|
groups: [dep.requirement_type].compact
|
|
115
116
|
}],
|
|
116
117
|
package_manager: "uv"
|
|
@@ -353,6 +354,36 @@ module Dependabot
|
|
|
353
354
|
NameNormaliser.normalise(name)
|
|
354
355
|
end
|
|
355
356
|
|
|
357
|
+
sig do
|
|
358
|
+
params(
|
|
359
|
+
git_tag_sources: T::Hash[String, T::Hash[Symbol, String]],
|
|
360
|
+
name: String
|
|
361
|
+
).returns(T.nilable(T::Hash[Symbol, String]))
|
|
362
|
+
end
|
|
363
|
+
def git_source_for(git_tag_sources, name)
|
|
364
|
+
normalised = normalise(name)
|
|
365
|
+
match = git_tag_sources.find { |key, _| normalise(key) == normalised }
|
|
366
|
+
return nil unless match
|
|
367
|
+
|
|
368
|
+
{ type: "git" }.merge(match[1])
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# nil alongside a git source, as the Poetry path does (python/lib/.../pyproject_files_parser.rb
|
|
372
|
+
# git_requirement). Keeping the PEP 508 constraint makes requirements_up_to_date? compare it
|
|
373
|
+
# against the newest tag, so a `>=` floor above that tag reports the pin as current.
|
|
374
|
+
sig do
|
|
375
|
+
params(
|
|
376
|
+
requirement: T.nilable(String),
|
|
377
|
+
git_source: T.nilable(T::Hash[Symbol, String])
|
|
378
|
+
).returns(T.nilable(String))
|
|
379
|
+
end
|
|
380
|
+
def requirement_for(requirement, git_source)
|
|
381
|
+
return nil if git_source
|
|
382
|
+
|
|
383
|
+
# In uv no constraint means any version is acceptable
|
|
384
|
+
requirement == "" ? "*" : requirement
|
|
385
|
+
end
|
|
386
|
+
|
|
356
387
|
sig { returns(PyprojectDocument) }
|
|
357
388
|
def pyproject_document
|
|
358
389
|
@pyproject_document ||= PyprojectDocument.from_file(T.must(pyproject))
|
|
@@ -14,6 +14,7 @@ require "dependabot/uv/file_updater"
|
|
|
14
14
|
require "dependabot/uv/native_helpers"
|
|
15
15
|
require "dependabot/uv/name_normaliser"
|
|
16
16
|
require "dependabot/uv/requirement_suffix_helper"
|
|
17
|
+
require "dependabot/uv/sources_table"
|
|
17
18
|
|
|
18
19
|
module Dependabot
|
|
19
20
|
module Uv
|
|
@@ -145,13 +146,18 @@ module Dependabot
|
|
|
145
146
|
return content unless file_changed?(file)
|
|
146
147
|
|
|
147
148
|
updated_content = content.dup
|
|
149
|
+
nothing_to_rewrite = T.let(false, T::Boolean)
|
|
148
150
|
|
|
149
151
|
T.must(dependency).requirements.zip(T.must(T.must(dependency).previous_requirements)).each do |new_r, old_r|
|
|
150
152
|
next unless new_r.file == file.name && T.must(old_r).file == file.name
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
rewritten = rewrite_requirement(updated_content, new_r, T.must(old_r))
|
|
155
|
+
nothing_to_rewrite = true if rewritten.nil?
|
|
156
|
+
updated_content = rewritten if rewritten
|
|
153
157
|
end
|
|
154
158
|
|
|
159
|
+
return content if nothing_to_rewrite && content == updated_content
|
|
160
|
+
|
|
155
161
|
raise DependencyFileContentNotChanged, "Content did not change!" if content == updated_content
|
|
156
162
|
|
|
157
163
|
updated_content
|
|
@@ -200,6 +206,106 @@ module Dependabot
|
|
|
200
206
|
updated_content
|
|
201
207
|
end
|
|
202
208
|
|
|
209
|
+
sig { returns(T::Boolean) }
|
|
210
|
+
def git_dependency?
|
|
211
|
+
T.must(dependency).requirements.any? { |r| r.source_string("type") == "git" }
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# nil when this file has nothing to rewrite: updated_git_requirements stamps the resolved source
|
|
215
|
+
# onto every requirement of the merged dependency, including one from a manifest that does not
|
|
216
|
+
# declare it, and that file had nothing to rewrite before this either.
|
|
217
|
+
sig do
|
|
218
|
+
params(
|
|
219
|
+
content: String,
|
|
220
|
+
new_r: Dependabot::DependencyRequirement,
|
|
221
|
+
old_r: Dependabot::DependencyRequirement
|
|
222
|
+
).returns(T.nilable(String))
|
|
223
|
+
end
|
|
224
|
+
def rewrite_requirement(content, new_r, old_r)
|
|
225
|
+
return replace_git_tag(T.must(dependency), content, new_r, old_r) if git_tag_moved?(new_r, old_r)
|
|
226
|
+
return nil if git_source_arrived?(new_r, old_r)
|
|
227
|
+
|
|
228
|
+
replace_dep(T.must(dependency), content, new_r, old_r)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
sig do
|
|
232
|
+
params(new_r: Dependabot::DependencyRequirement, old_r: Dependabot::DependencyRequirement)
|
|
233
|
+
.returns(T::Boolean)
|
|
234
|
+
end
|
|
235
|
+
def git_source_arrived?(new_r, old_r)
|
|
236
|
+
new_r.source_string("type") == "git" && old_r.source_string("type").nil?
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
sig do
|
|
240
|
+
params(new_r: Dependabot::DependencyRequirement, old_r: Dependabot::DependencyRequirement)
|
|
241
|
+
.returns(T::Boolean)
|
|
242
|
+
end
|
|
243
|
+
def git_tag_moved?(new_r, old_r)
|
|
244
|
+
return false unless new_r.source_string("type") == "git"
|
|
245
|
+
return false unless old_r.source_string("type") == "git"
|
|
246
|
+
|
|
247
|
+
old_ref = old_r.source_string("ref")
|
|
248
|
+
new_ref = new_r.source_string("ref")
|
|
249
|
+
return false if old_ref.nil? || new_ref.nil?
|
|
250
|
+
|
|
251
|
+
old_ref != new_ref
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
sig do
|
|
255
|
+
params(
|
|
256
|
+
dep: Dependabot::Dependency,
|
|
257
|
+
content: String,
|
|
258
|
+
new_r: Dependabot::DependencyRequirement,
|
|
259
|
+
old_r: Dependabot::DependencyRequirement
|
|
260
|
+
).returns(String)
|
|
261
|
+
end
|
|
262
|
+
def replace_git_tag(dep, content, new_r, old_r)
|
|
263
|
+
old_ref = T.must(old_r.source_string("ref"))
|
|
264
|
+
new_ref = T.must(new_r.source_string("ref"))
|
|
265
|
+
|
|
266
|
+
key = raw_source_key(content, dep.name, old_ref)
|
|
267
|
+
return content unless key
|
|
268
|
+
|
|
269
|
+
span = SourcesTable.span(content)
|
|
270
|
+
return content unless span
|
|
271
|
+
|
|
272
|
+
rewritten = span[1].sub(SourcesTable.tag_regex(key, old_ref)) do
|
|
273
|
+
"#{Regexp.last_match(1)}#{new_ref}#{Regexp.last_match(2)}"
|
|
274
|
+
end
|
|
275
|
+
candidate = content.dup.tap { |c| c[span[0]] = rewritten }
|
|
276
|
+
moved_tag?(candidate, key, new_ref) ? candidate : content
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# The table is located by pattern over raw text, so a [tool.uv.sources] block quoted inside
|
|
280
|
+
# a string can answer for the real one. Asking TOML what the result says the tag is turns any
|
|
281
|
+
# such surprise into the no-op this had before, instead of an edit reported as a bump.
|
|
282
|
+
sig { params(content: String, key: String, ref: String).returns(T::Boolean) }
|
|
283
|
+
def moved_tag?(content, key, ref)
|
|
284
|
+
TomlRB.parse(content).dig("tool", "uv", "sources", key, "tag") == ref
|
|
285
|
+
rescue TomlRB::ParseError
|
|
286
|
+
false
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# uv resolves a source under PEP 508 normalisation, so the file's key can differ from dep.name.
|
|
290
|
+
# Two keys can normalise the same - `pkg` and `Pkg_` - so the ref decides between them: the
|
|
291
|
+
# one whose entry actually carries it is the one the parser attached, and the only one this
|
|
292
|
+
# can rewrite.
|
|
293
|
+
sig { params(content: String, name: String, ref: String).returns(T.nilable(String)) }
|
|
294
|
+
def raw_source_key(content, name, ref)
|
|
295
|
+
sources = TomlRB.parse(content).dig("tool", "uv", "sources")
|
|
296
|
+
return nil unless sources.is_a?(Hash)
|
|
297
|
+
|
|
298
|
+
table = SourcesTable.span(content)&.last
|
|
299
|
+
return nil unless table
|
|
300
|
+
|
|
301
|
+
normalised = normalise(name)
|
|
302
|
+
sources.keys.find do |key|
|
|
303
|
+
normalise(key) == normalised && table.match?(SourcesTable.tag_regex(key, ref))
|
|
304
|
+
end
|
|
305
|
+
rescue TomlRB::ParseError
|
|
306
|
+
nil
|
|
307
|
+
end
|
|
308
|
+
|
|
203
309
|
sig { params(req1: String, req2: String).returns(T::Boolean) }
|
|
204
310
|
def requirements_match?(req1, req2)
|
|
205
311
|
normalized_requirement(req1) == normalized_requirement(req2)
|
|
@@ -306,7 +412,11 @@ module Dependabot
|
|
|
306
412
|
# uv lock --upgrade-package expects the base package name without extras
|
|
307
413
|
base_dep_name = normalise(dep_name)
|
|
308
414
|
package_spec =
|
|
309
|
-
if
|
|
415
|
+
if git_dependency?
|
|
416
|
+
# There is no index to pin a version against: the ref in [tool.uv.sources] has already
|
|
417
|
+
# been rewritten, so re-resolving the package by name is what picks the new tag up.
|
|
418
|
+
base_dep_name
|
|
419
|
+
elsif target_requirement
|
|
310
420
|
"#{base_dep_name}#{target_requirement}"
|
|
311
421
|
elsif dep_version
|
|
312
422
|
"#{base_dep_name}==#{dep_version}"
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "sorbet-runtime"
|
|
5
|
+
|
|
6
|
+
require "dependabot/dependency_file"
|
|
7
|
+
require "dependabot/python/file_parser/pyproject_document"
|
|
8
|
+
|
|
9
|
+
module Dependabot
|
|
10
|
+
module Uv
|
|
11
|
+
# Where [tool.uv.sources] sits in a manifest's text. The parser decides which entries can be
|
|
12
|
+
# rewritten and the file updater rewrites them, so both have to agree on the table's extent: over
|
|
13
|
+
# the whole file a line of the same shape in another tool's table answers for either.
|
|
14
|
+
module SourcesTable
|
|
15
|
+
extend T::Sig
|
|
16
|
+
|
|
17
|
+
# A trailing comment and a CRLF line ending both belong on this line, and neither should turn
|
|
18
|
+
# the feature off without a word.
|
|
19
|
+
HEADER = /^[ \t]*\[tool\.uv\.sources\][ \t]*(?:\#[^\r\n]*)?\r?$/
|
|
20
|
+
NEXT_TABLE = /^[ \t]*\[/
|
|
21
|
+
|
|
22
|
+
# What the rewrite anchors on: the key verbatim at the start of its line, and the tag it is
|
|
23
|
+
# expected to carry. Both sides use this, so what the parser accepts is exactly what can be
|
|
24
|
+
# rewritten - a shape only one of them understood is what turned a silent no-op into a job
|
|
25
|
+
# failure.
|
|
26
|
+
sig { params(key: String, ref: String).returns(Regexp) }
|
|
27
|
+
def self.tag_regex(key, ref)
|
|
28
|
+
# Quoting is the only legal TOML spelling for a name carrying a dot - zope.interface,
|
|
29
|
+
# ruamel.yaml - so both the key and the inner `tag` are matched with or without quotes. The
|
|
30
|
+
# `,` before `tag` is what stops the pattern latching onto the tail of another key.
|
|
31
|
+
/
|
|
32
|
+
(^[ \t]*["']?#{Regexp.escape(key)}["']?[ \t]*=[ \t]*
|
|
33
|
+
\{(?:[^}]*?,)?[ \t]*["']?tag["']?[ \t]*=[ \t]*["'])
|
|
34
|
+
#{Regexp.escape(ref)}
|
|
35
|
+
(["'])
|
|
36
|
+
/x
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# The git-and-tag entries of a manifest that this file can rewrite, keyed as the author wrote
|
|
40
|
+
# them. TomlRB is stricter than the tomli the Python helper uses, and this is the first time the
|
|
41
|
+
# Ruby side reads a workspace member manifest, so one it rejects yields nothing rather than
|
|
42
|
+
# failing the job.
|
|
43
|
+
sig { params(file: Dependabot::DependencyFile).returns(T::Hash[String, T::Hash[Symbol, String]]) }
|
|
44
|
+
def self.writable_for(file)
|
|
45
|
+
document = Dependabot::Python::FileParser::PyprojectDocument.from_file(file)
|
|
46
|
+
writable(T.must(file.content), document.uv_git_tag_sources)
|
|
47
|
+
rescue Dependabot::DependencyFileNotParseable
|
|
48
|
+
{}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The entries of `sources` this file can rewrite. Reporting a moved ref for one it cannot reach
|
|
52
|
+
# would fail the job, where before the pin was never updated.
|
|
53
|
+
sig do
|
|
54
|
+
params(content: String, sources: T::Hash[String, T::Hash[Symbol, String]])
|
|
55
|
+
.returns(T::Hash[String, T::Hash[Symbol, String]])
|
|
56
|
+
end
|
|
57
|
+
def self.writable(content, sources)
|
|
58
|
+
found = span(content)
|
|
59
|
+
return {} unless found
|
|
60
|
+
|
|
61
|
+
table = found[1]
|
|
62
|
+
sources.select { |key, source| table.match?(tag_regex(key, T.must(source[:ref]))) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The table's own text, and the range it occupies in the manifest.
|
|
66
|
+
sig { params(content: String).returns(T.nilable([T::Range[Integer], String])) }
|
|
67
|
+
def self.span(content)
|
|
68
|
+
header = content.match(HEADER)
|
|
69
|
+
return nil unless header
|
|
70
|
+
|
|
71
|
+
from = header.end(0)
|
|
72
|
+
rest = content[from..] || ""
|
|
73
|
+
nxt = rest.match(NEXT_TABLE)
|
|
74
|
+
to = nxt ? from + nxt.begin(0) : content.length
|
|
75
|
+
[Range.new(from, to, true), T.must(content[from...to])]
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -34,6 +34,8 @@ module Dependabot
|
|
|
34
34
|
|
|
35
35
|
sig { override.returns(T::Array[Dependabot::DependencyRequirement]) }
|
|
36
36
|
def updated_requirements
|
|
37
|
+
return updated_git_requirements if git_dependency?
|
|
38
|
+
|
|
37
39
|
RequirementsUpdater.new(
|
|
38
40
|
requirements: dependency.requirements,
|
|
39
41
|
latest_resolvable_version: preferred_resolvable_version&.to_s,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-uv
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.404.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.404.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.404.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: dependabot-python
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.
|
|
32
|
+
version: 0.404.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
39
|
+
version: 0.404.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: debug
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -290,6 +290,7 @@ files:
|
|
|
290
290
|
- lib/dependabot/uv/requirement_parser.rb
|
|
291
291
|
- lib/dependabot/uv/requirement_suffix_helper.rb
|
|
292
292
|
- lib/dependabot/uv/requirements_file_matcher.rb
|
|
293
|
+
- lib/dependabot/uv/sources_table.rb
|
|
293
294
|
- lib/dependabot/uv/update_checker.rb
|
|
294
295
|
- lib/dependabot/uv/update_checker/latest_version_finder.rb
|
|
295
296
|
- lib/dependabot/uv/update_checker/lock_file_resolver.rb
|
|
@@ -302,7 +303,7 @@ licenses:
|
|
|
302
303
|
- MIT
|
|
303
304
|
metadata:
|
|
304
305
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
305
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
306
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.404.0
|
|
306
307
|
rdoc_options: []
|
|
307
308
|
require_paths:
|
|
308
309
|
- lib
|