# crate-ingredients

This package contains Python bindings for the [`ingredients`] crate, which implements checks for the
contents ("ingredients") of published Rust crates.

Both comparing contents of published crates to the state of the upstream project repository at a
specific point in time ("report" mode) and comparing two different, published versions of the same
crate with each other ("diff" mode) are implemented.

The Python API provided by `crate-ingredients` is intended to match the Rust API provided by the
`ingredients` crate, wherever possible and reasonable.

## `report` mode

Example using the Python API:

```python
from crate_ingredients import Crate

crate = Crate.download("syn", "2.0.111")

report = crate.report()
print(report)
```

## `diff` mode

Example using the Python API:

```python
from crate_ingredients import Crate

old = Crate.download("syn", "2.0.110")
new = Crate.download("syn", "2.0.111")

diff = old.diff(new)
print(diff)
```

## Installation

From [PyPI]: `pip install crate-ingredients`

## External dependencies

**Building**:

* `cargo` (refer to `package.rust-version` in `Cargo.toml` for the minimum supported Rust version)
* `openssl` development headers must be available (for `reqwest/native-tls`)

**Runtime**:

* `cargo` must be available in `$PATH`
* `git` must be available in `$PATH` when calling `Crate.report`

[`ingredients`]: https://crates.io/crates/ingredients
[PyPI]: https://pypi.org/project/crate-ingredients/
