Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

python_install (3) Versions 1.2.0

Provides a resource for installing Python from source

Policyfile
Berkshelf
Knife
cookbook 'python_install', '~> 1.2.0', :supermarket
cookbook 'python_install', '~> 1.2.0'
knife supermarket install python_install
knife supermarket download python_install
README
Dependencies
Changelog
Quality 33%

Python Install Cookbook

License
GitHub Tag
Build status

Maintainer: OIT Systems Engineering (ua-oit-se@alaska.edu)

Purpose

This cookbook provides a single resource that downloads, configures, compiles, and installs Python.
As Python is built from source, build times can be long, especially for Python 3.7.
If building OpenSSL, SQLite, and Python, the first run builds can take more than a half hour.
On burstable instance types, CPU credits tend to deplete on small instances (smaller than an EC2 t3.medium).

Requirements

Chef

This cookbook requires Chef 14+

Platforms

Supported Platform Families:

  • Debian
    • Ubuntu, Mint
  • Red Hat Enterprise Linux
    • Amazon, CentOS, Oracle

Platforms validated via Test Kitchen:

  • Ubuntu
  • Debian
  • CentOS
  • Oracle
  • Fedora
  • Amazon

Notes:

  • This cookbook should support any recent Linux variant.

Dependencies

This cookbook does not constrain its dependencies because it is intended as a utility library.
It should ultimately be used within a wrapper cookbook.

Resources

This cookbook provides one resource for creating an Python installation.

python_installation

This resource provides a single action to create an Python installation.

Actions

One action is provided.

  • :create - Post condition is that source and binary artifacts exist in specified directories.

Attributes

  • version - Defaults to nil. The version of Python to install. If nil, will default to the latest version when this cookbook was updated. The helper default_python_version is provided for fetching this value.
  • download_directory - Defaults to nil. The local path to the directory into which to download the source archive. See note below about paths.
  • build_directory - Defaults to nil. The local path to the directory into which to decompress and build the source code. See note below about paths.
  • install_directory - Defaults to nil. The local path to the directory into which to install the binary artifacts. If nil, will default to a platform-standard location. The helper default_python_directory is provided for fetching this location. See note below about paths.
  • openssl_directory - Defaults to nil. The local path to the directory where OpenSSL is installed. If nil, system OpenSSL will be used and must be installed prior to this resource running. For an OpenSSL resource, see the openssl_install cookbook
  • sqlite_directory - Defaults to nil. The local path to the directory where SQLite is installed. If nil, system SQLite will be used and must be installed prior to this resource running. For an SQLite resource, see the sqlite_install cookbook
  • build_shared - Defaults to false. If true, shared libraries are built. Building shared libraries increases build time noticeably. For Python 3.6 (not 3.5, not 3.7) this will also disable optimizations to workaround an issue in the Python build system.
  • owner - Defaults to root. The owner of all artifacts.
  • group - Defaults to root. The group of all artifacts.

Note on paths

If a path is set for download, build or install, then the client must assure the directory exists before the resource runs.
The resource runs as root and sets permissions on any created files, so is capable of placing a user-owned directory in a root-owned directory.

Fairly standard defaults are used for paths.
If download_directory or build_directory is nil (default), '/var/chef/cache' will be used.
If install directory is nil (default), "/opt/python/#{version}" will be created and used.

For build_directory, the path given is the parent of the source root that is created when the archive is extracted.
For example, if build_directory is set to '/usr/local/python-src', then the source root will be "/usr/local/python-src/Python-#{version}".

For install_directory, the path given is the root of the install.
For example, if install_directory is set to '/usr/local/python', then the path to the Python executable will be '/usr/local/python/bin/python'.
The lib path must be added to linker and runtime configurations (typically use -L and rpath, respectively) for dependents to load the custom libraries.

Recipes

This cookbook provides no recipes.

Examples

Custom resources can be used as below.

python_installation 'No Defaults' do
  version '3.6.9'
  download_directory '/usr/local/python-dl'
  build_directory '/usr/local/python-bld'
  install_directory '/usr/local/python'
  openssl_directory '/opt/openssl/1.1.1c'
  sqlite_directory '/opt/sqlite/3300000'
  owner 'some-dude'
  group 'some-dudes'
end

Development

See CONTRIBUTING.md and TESTING.md.

Changelog for Python Install Cookbook

1.2.0

  • Fix build of shared libs for Python 3.7
  • Improve idempotence of resource by sacrificing robustness of rebuild

1.1.0

  • Added helpers for default version and path
  • Created installer library

1.0.0

  • Initial release

Collaborator Number Metric
            

1.2.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

1.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

1.2.0 passed this metric

No Binaries Metric
            

1.2.0 passed this metric

Testing File Metric
            

1.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

1.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number