Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
Update docs to reflect introduction of backend to `Grype` class constructor.
  • Loading branch information
robberwick committed Jul 28, 2024
1 parent 6efe369 commit ce16205
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ Supported commands

## Getting started
### Prerequisites
PyGrype relies on an existing grype binary. [Install grype following the official instructions](https://github.com/anchore/grype#installation).
PyGrype relies on either an existing grype binary, or a local Docker install.

[Install grype binary following the official instructions](https://github.com/anchore/grype#installation).

[Install Docker following the official instructions](https://docs.docker.com/get-docker/)

### Installation
install using `pip`
Expand All @@ -33,15 +37,30 @@ pip install pygrype
```

## Usage
Instantiate `Grype` using the default path

Pygrype is wrapper around the `grype` binary, and can be used in two ways: using a local binary, or using the official Docker container.

### Using Local Binary
Instantiate `Grype` without any arguments. This will use the default binary backend, and will look for the `grype` binary in the system path.

```python3
from pygrype import Grype
grype = Grype()
```
or specify the binary
```python3
from pygrype import Grype
grype = Grype(path='/opt/grype')
from pygrype import Grype, GrypeBinaryBackend
binary_backend = GrypeBinaryBackend(path='/opt/grype')
grype = Grype(backend=binary_backend)
```

### Using Docker
Instantiate `Grype` with the `GrypeDockerBackend` backend. This will use the [official grype Docker container](https://hub.docker.com/r/anchore/grype) to run scans. The backend will use the latest version of the container by default, but you can specify a specific version using the optional `tag` argument.

```python3
from pygrype import Grype, GrypeDockerBackend
docker_backend = GrypeDockerBackend(tag="v0.79.2")
grype = Grype(backend=docker_backend)
```

## Full example
Expand Down

0 comments on commit ce16205

Please sign in to comment.