Class: Dependabot::Python::Language

Inherits:
Ecosystem::VersionManager
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/python/language.rb

Constant Summary collapse

PRE_INSTALLED_PYTHON_VERSIONS_RAW =

This list must match the versions specified at the top of ‘python/Dockerfile` ARG PY_3_13=3.13.2 When updating this list, also update uv/lib/dependabot/uv/language.rb

%w(
  3.14.0
  3.13.9
  3.12.12
  3.11.14
  3.10.19
  3.9.24
).freeze
PRE_INSTALLED_PYTHON_VERSIONS =
T.let(
  PRE_INSTALLED_PYTHON_VERSIONS_RAW.map do |v|
    Version.new(v)
  end.sort,
  T::Array[Dependabot::Python::Version]
)
PRE_INSTALLED_VERSIONS_MAP =
T.let(
  PRE_INSTALLED_PYTHON_VERSIONS.to_h do |v|
    [Dependabot::Python::Version.new(T.must(v.segments[0..1]).join(".")), v]
  end,
  T::Hash[Dependabot::Python::Version, Dependabot::Python::Version]
)
PRE_INSTALLED_HIGHEST_VERSION =
T.let(T.must(PRE_INSTALLED_PYTHON_VERSIONS.max), Dependabot::Python::Version)
SUPPORTED_VERSIONS =
T.let(
  PRE_INSTALLED_PYTHON_VERSIONS.map do |v|
    Dependabot::Python::Version.new(T.must(v.segments[0..1]&.join(".")))
  end,
  T::Array[Dependabot::Python::Version]
)
NON_SUPPORTED_HIGHEST_VERSION =
"3.8"
DEPRECATED_VERSIONS =
T.let([Version.new(NON_SUPPORTED_HIGHEST_VERSION)].freeze, T::Array[Dependabot::Version])

Instance Method Summary collapse

Constructor Details

#initialize(detected_version:, raw_version: nil, requirement: nil) ⇒ Language

Returns a new instance of Language.



61
62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/python/language.rb', line 61

def initialize(detected_version:, raw_version: nil, requirement: nil)
  super(
    name: LANGUAGE,
    detected_version: detected_version ? major_minor_version(detected_version) : nil,
    version: raw_version ? Version.new(raw_version) : nil,
    deprecated_versions: DEPRECATED_VERSIONS,
    supported_versions: SUPPORTED_VERSIONS,
    requirement: requirement,
 )
end