dependabot-python 0.381.0 → 0.382.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: f0477e6159f9fcd2dfd744b603b9bd23ba2df5ad50c3bf3a8fc51fbcd00e6306
4
- data.tar.gz: 1271ebda6e197461e2721a7aa0f69d917dc8c506813465931ba01ae143f3c34a
3
+ metadata.gz: e521f3e297026d2b21597f830c9978e6365a5dd4b99ad7a24a9d0973772db45d
4
+ data.tar.gz: 446649a64857c3cc95aeed4c7e4c9d37bf55e6b5573e82445c6b0b0e4fc10f33
5
5
  SHA512:
6
- metadata.gz: ca638414b000ecf033fa4470316f3858a1f57e9ca496db678b9779da39a292aaaaf66908b037e6b6f0c02ad528c9142cd42a687149a75887b053dc5001dd5ff8
7
- data.tar.gz: 34164a7fcbc0eb80ee3cdfe995cd891560fe9b2feaab98ec3be721699117897855be5a6f76bb76cea581b2cf18b60cc378df2a1128042197582894154abb308f
6
+ metadata.gz: 2b67ffd686818a7d3e3399a2493a188815959102bc4235086ed16fc47b1bdf93a392e743cc2fb411619f90b9c1b01d0ce27de7e65b53e1ed6e52dfaf67b58107
7
+ data.tar.gz: 269b0733ac11ef8d19cefa5c972e6e67330c51792981fc98a80e389f6338477a099e62ab184873d28ce26dddf8d8b5213c1c2baed56b5d18b6ee9b8097f86338
@@ -65,6 +65,10 @@ module Dependabot
65
65
  sig { override.void }
66
66
  def prepare!
67
67
  if poetry_project_without_lockfile?
68
+ # Generating an ephemeral lockfile requires executing `poetry lock`. Strictly speaking, that violates our
69
+ # policy of refusing to run Python tooling when external code execution is disallowed, so fail fast.
70
+ raise Dependabot::UnexpectedExternalCode if file_parser.reject_external_code?
71
+
68
72
  Dependabot.logger.info("No poetry.lock found, generating ephemeral lockfile for dependency graphing")
69
73
  generate_ephemeral_lockfile!
70
74
  emit_missing_lockfile_warning! if @ephemeral_lockfile_generated
@@ -209,7 +209,10 @@ module Dependabot
209
209
 
210
210
  sig { returns(T::Array[DependencyFile]) }
211
211
  def pip_compile_files
212
- @pip_compile_files ||= T.let(dependency_files.select { |f| f.name.end_with?(".in") }, T.untyped)
212
+ @pip_compile_files ||= T.let(
213
+ dependency_files.select { |f| f.name.end_with?(".in") },
214
+ T.nilable(T::Array[DependencyFile])
215
+ )
213
216
  end
214
217
  end
215
218
  end
@@ -65,7 +65,7 @@ module Dependabot
65
65
  # Parses a single pip requirement string (e.g. "types-requests==2.31.0.10")
66
66
  # into a structured hash. Returns nil if the string is not a valid requirement
67
67
  # or has no version constraint.
68
- sig { params(dependency_string: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
68
+ sig { params(dependency_string: String).returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
69
69
  def self.parse(dependency_string)
70
70
  match = dependency_string.strip.match(VALID_REQ_TXT_REQUIREMENT)
71
71
  return nil unless match
@@ -92,17 +92,17 @@ module Dependabot
92
92
  sig { params(requirements_string: String).returns(T.nilable(String)) }
93
93
  def self.extract_pinned_version(requirements_string)
94
94
  requirement = Dependabot::Python::Requirement.new(requirements_string)
95
- constraints = T.let(requirement.requirements, T::Array[T::Array[T.untyped]])
95
+ constraints = T.let(requirement.requirements, T::Array[[String, Gem::Version]])
96
96
 
97
97
  exact_pin = constraints.find do |pair|
98
- op = T.cast(pair[0], String)
98
+ op = pair[0]
99
99
  op == "==" || op == "="
100
100
  end
101
- return T.cast(exact_pin[1], Gem::Version).to_s if exact_pin
101
+ return exact_pin[1].to_s if exact_pin
102
102
 
103
103
  lower_bound_operators = %w(>= > ~>).freeze
104
- lower_bound = constraints.find { |pair| lower_bound_operators.include?(T.cast(pair[0], String)) }
105
- return T.cast(lower_bound[1], Gem::Version).to_s if lower_bound
104
+ lower_bound = constraints.find { |pair| lower_bound_operators.include?(pair[0]) }
105
+ return lower_bound[1].to_s if lower_bound
106
106
 
107
107
  nil
108
108
  rescue Gem::Requirement::BadRequirementError
@@ -93,16 +93,18 @@ module Dependabot
93
93
  )
94
94
  end
95
95
 
96
- sig { override.returns(T::Array[T::Hash[Symbol, T.untyped]]) }
96
+ sig { override.returns(T::Array[Dependabot::DependencyRequirement]) }
97
97
  def updated_requirements
98
- return updated_git_requirements if git_dependency?
99
-
100
- RequirementsUpdater.new(
101
- requirements: requirements,
102
- latest_resolvable_version: preferred_resolvable_version&.to_s,
103
- update_strategy: requirements_update_strategy,
104
- has_lockfile: !(pipfile_lock || poetry_lock).nil?
105
- ).updated_requirements
98
+ return wrap_requirements(updated_git_requirements) if git_dependency?
99
+
100
+ wrap_requirements(
101
+ RequirementsUpdater.new(
102
+ requirements: requirements,
103
+ latest_resolvable_version: preferred_resolvable_version&.to_s,
104
+ update_strategy: requirements_update_strategy,
105
+ has_lockfile: !(pipfile_lock || poetry_lock).nil?
106
+ ).updated_requirements
107
+ )
106
108
  end
107
109
 
108
110
  sig { override.returns(T::Boolean) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-python
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.381.0
4
+ version: 0.382.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.381.0
18
+ version: 0.382.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.381.0
25
+ version: 0.382.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -323,7 +323,7 @@ licenses:
323
323
  - MIT
324
324
  metadata:
325
325
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
326
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.381.0
326
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.382.0
327
327
  rdoc_options: []
328
328
  require_paths:
329
329
  - lib