I have a pip style requirements.txt file I use for keeping track of my python dependencies, I'm moving my dev environment over to vagrant + puppet. So far I've been using the pip provider built into puppet to install individual packages like this:
package {
["django", "nose"]:
ensure => present,
provider => pip
}
Is it possible to pass in my requirements.txt instead and have puppet keep the packages up to date whenever that file changes?
Requirements files serve as a list of items to be installed by pip, when using pip install. Files that use this format are often called “pip requirements. txt files”, since requirements. txt is usually what these files are named (although, that is not a requirement).
Typically the requirements. txt file is located in the root directory of your project. Notice we have a line for each package, then a version number. This is important because as you start developing your python applications, you will develop the application with specific versions of the packages in mind.
Save the Python requirements. txt file in the project source code repository so that other developers can easily install all of the Python modules and packages when they clone or check out your project. Use the pip install -r requirements.
Yes it is possible. Instead of defining a package resource, define a "exec" resource instead that will take the requirements.txt as variable and runs the pip install command.
E.g.
class pip_install(
$path_requirements_file,
){
exec { "pip_requirements_install":
command => "pip install -r ${path_requirements_file}",
refreshonly => true,
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With