Class: Dependabot::Python::Language

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

Constant Summary collapse

PYTHON_3_13 =

These versions should match the versions specified at the top of ‘python/Dockerfile`

"3.13"
PYTHON_3_12 =
"3.12"
PYTHON_3_11 =
"3.11"
PYTHON_3_10 =
"3.10"
PYTHON_3_9 =
"3.9"
PYTHON_3_8 =
"3.8"
DEPRECATED_VERSIONS =
T.let([Version.new(PYTHON_3_8)].freeze, T::Array[Dependabot::Version])
SUPPORTED_VERSIONS =

Keep versions in ascending order

T.let([
  Version.new(PYTHON_3_9),
  Version.new(PYTHON_3_10),
  Version.new(PYTHON_3_11),
  Version.new(PYTHON_3_12),
  Version.new(PYTHON_3_13)
].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.



40
41
42
43
44
45
46
47
48
49
# File 'lib/dependabot/python/language.rb', line 40

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

Instance Method Details

#deprecated?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
# File 'lib/dependabot/python/language.rb', line 52

def deprecated?
  return false unless detected_version
  return false if unsupported?
  return false unless Dependabot::Experiments.enabled?(:python_3_8_deprecation_warning)

  deprecated_versions.include?(detected_version)
end

#unsupported?Boolean

Returns:

  • (Boolean)


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

def unsupported?
  return false unless detected_version
  return false unless Dependabot::Experiments.enabled?(:python_3_8_unsupported_error)

  supported_versions.all? { |supported| supported > detected_version }
end