Class: Dependabot::FileFetchers::Python::Pip

Inherits:
Base
  • Object
show all
Defined in:
lib/dependabot/file_fetchers/python/pip.rb

Constant Summary collapse

CHILD_REQUIREMENT_REGEX =
/^-r\s?(?<path>.*\.txt)/.freeze
CONSTRAINT_REGEX =
/^-c\s?(?<path>\..*)/.freeze

Instance Attribute Summary

Attributes inherited from Base

#credentials, #source

Class Method Summary collapse

Methods inherited from Base

#commit, #directory, #files, #initialize, #repo, #target_branch

Constructor Details

This class inherits a constructor from Dependabot::FileFetchers::Base

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dependabot/file_fetchers/python/pip.rb', line 16

def self.required_files_in?(filenames)
  return true if filenames.any? { |name| name.end_with?(".txt", ".in") }

  # If there is a directory of requirements return true
  return true if filenames.include?("requirements")

  # If this repo is using a Pipfile return true
  return true if filenames.include?("Pipfile")

  # If this repo is using Poetry return true
  return true if filenames.include?("pyproject.toml")

  filenames.include?("setup.py")
end

.required_files_messageObject



31
32
33
34
# File 'lib/dependabot/file_fetchers/python/pip.rb', line 31

def self.required_files_message
  "Repo must contain a requirements.txt, setup.py, pyproject.toml, "\
  "or a Pipfile."
end