Class: PoisePython::Resources::PythonPackage::Provider

Inherits:
Chef::Provider::Package
  • Object
show all
Includes:
PythonCommandMixin
Defined in:
lib/poise_python/resources/python_package.rb

Overview

The default provider for the python_package resource.

See Also:

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#install_package(name, version)

This method returns an undefined value.

Install package(s) using pip.

Parameters:

  • name (String, Array<String>)

    Name(s) of package(s).

  • version (String, Array<String>)

    Version(s) of package(s).

Since:

  • 1.0.0



249
250
251
# File 'lib/poise_python/resources/python_package.rb', line 249

def install_package(name, version)
  pip_install(name, version, upgrade: false)
end

#remove_package(name, version)

This method returns an undefined value.

Uninstall package(s) using pip.

Parameters:

  • name (String, Array<String>)

    Name(s) of package(s).

  • version (String, Array<String>)

    Version(s) of package(s).

Since:

  • 1.0.0



267
268
269
# File 'lib/poise_python/resources/python_package.rb', line 267

def remove_package(name, version)
  pip_command('uninstall', :install, %w{--yes} + [name].flatten)
end

#upgrade_package(name, version)

This method returns an undefined value.

Upgrade package(s) using pip.

Parameters:

  • name (String, Array<String>)

    Name(s) of package(s).

  • version (String, Array<String>)

    Version(s) of package(s).

Since:

  • 1.0.0



258
259
260
# File 'lib/poise_python/resources/python_package.rb', line 258

def upgrade_package(name, version)
  pip_install(name, version, upgrade: true)
end