Class: PoisePython::Resources::PythonRuntime::Resource

Inherits:
Chef::Resource
  • Object
show all
Defined in:
lib/poise_python/resources/python_runtime.rb

Overview

A python_runtime resource to manage Python installations.

Examples:

python_runtime '2.7'

Since:

  • 1.0.0

Provides:

  • python_runtime

Actions:

  • install

  • uninstall

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#get_pip_urlString

URL to download the get-pip.py script from. If not sure, the default of https://bootstrap.pypa.io/get-pip.py is used. If you want to skip the pip installer entirely, set #pip_version to false.

Returns:

  • (String)


55
# File 'lib/poise_python/resources/python_runtime.rb', line 55

attribute(:get_pip_url, kind_of: String, default: 'https://bootstrap.pypa.io/get-pip.py')

#pip_versionString, Boolean

Note:

Disabling the pip install may result in other resources being non-functional.

Version of pip to install. If set to true, the latest available pip will be used. If set to false, pip will not be installed. If set to a URL, that will be used as the URL to get-pip.py instead of #get_pip_url.

Returns:

  • (String, Boolean)


64
# File 'lib/poise_python/resources/python_runtime.rb', line 64

attribute(:pip_version, kind_of: [String, TrueClass, FalseClass], default: true)

#setuptools_versionString, Boolean

Version of Setuptools to install. It set to true, the latest available version will be used. If set to false, setuptools will not be installed.

Returns:

  • (String, Boolean)


70
# File 'lib/poise_python/resources/python_runtime.rb', line 70

attribute(:setuptools_version, kind_of: [String, TrueClass, FalseClass], default: true)

#versionString

Version of Python to install. The version is prefix-matched so '2' will install the most recent Python 2.x, and so on.

Examples:

Install any version

python_runtime 'any' do
  version ''
end

Install Python 2.7

python_runtime '2.7'

Returns:

  • (String)


48
# File 'lib/poise_python/resources/python_runtime.rb', line 48

attribute(:version, kind_of: String, name_attribute: true)

#virtualenv_versionString, Boolean

Note:

Disabling the virtualenv install may result in other resources being non-functional.

Version of Virtualenv to install. It set to true, the latest available version will be used. If set to false, virtualenv will not be installed. Virtualenv will never be installed if the built-in venv module is available.

Returns:

  • (String, Boolean)


79
# File 'lib/poise_python/resources/python_runtime.rb', line 79

attribute(:virtualenv_version, kind_of: [String, TrueClass, FalseClass], default: true)

#wheel_versionString, Boolean

Version of Wheel to install. It set to true, the latest available version will be used. If set to false, wheel will not be installed.

Returns:

  • (String, Boolean)


85
# File 'lib/poise_python/resources/python_runtime.rb', line 85

attribute(:wheel_version, kind_of: [String, TrueClass, FalseClass], default: true)

Instance Method Details

#python_binaryString

The path to the python binary for this Python installation. This is an output property.

Examples:

execute "#{resources('python_runtime[2.7]').python_binary} myapp.py"

Returns:

  • (String)

Since:

  • 1.0.0



93
94
95
# File 'lib/poise_python/resources/python_runtime.rb', line 93

def python_binary
  provider_for_action(:python_binary).python_binary
end

#python_environmentHash<String, String>

The environment variables for this Python installation. This is an output property.

Examples:

execute '/opt/myapp.py' do
  environment resources('python_runtime[2.7]').python_environment
end

Returns:

  • (Hash<String, String>)

Since:

  • 1.0.0



105
106
107
# File 'lib/poise_python/resources/python_runtime.rb', line 105

def python_environment
  provider_for_action(:python_environment).python_environment
end