Sha256: 71d0c7373e1604441bcaa6c3a10a69d9b51a3c9aadfef07e20c23b0f809674cc

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

---
title: About the pip Resource
---

# pip

Use the `pip` InSpec audit resource to test packages that are installed using the Python PIP installer.

<br>

## Syntax

A `pip` resource block declares a package and (optionally) a package version:

    describe pip('package_name') do
      it { should be_installed }
    end

where

* `'package_name'` is the name of the package, such as `'Jinja2'`
* `be_installed` tests to see if the package described above is installed

<br>

## Examples

The following examples show how to use this InSpec audit resource.

### Test if Jinja2 is installed on the system

    describe pip('Jinja2') do
      it { should be_installed }
    end

### Test if Jinja2 2.8 is installed on the system

    describe pip('Jinja2') do
      it { should be_installed }
      its('version') { should eq '2.8' }
    end

<br>

## Matchers

This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

### be_installed

The `be_installed` matcher tests if the named package is installed on the system:

    it { should be_installed }

### version

The `version` matcher tests if the named package version is on the system:

    its('version') { should eq '1.2.3' }

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
inspec-1.50.1 docs/resources/pip.md.erb
inspec-1.49.2 docs/resources/pip.md.erb
inspec-1.48.0 docs/resources/pip.md.erb
inspec-1.47.0 docs/resources/pip.md.erb
inspec-1.46.2 docs/resources/pip.md.erb
inspec-1.45.13 docs/resources/pip.md.erb
inspec-1.45.9 docs/resources/pip.md.erb
inspec-1.44.8 docs/resources/pip.md.erb
inspec-1.43.8 docs/resources/pip.md.erb
inspec-1.43.5 docs/resources/pip.md.erb
inspec-1.42.3 docs/resources/pip.md.erb
inspec-1.41.0 docs/resources/pip.md.erb