# lambda-collaborator-report

Lambda for generating collaborator reports.

## Setup

Install Poetry using one of the methods [described in the documentation](https://python-poetry.org/docs/#installation).

```sh
$ brew install pipx
$ pipx install poetry
```

Install and activate the version of Python specified in [`.python-version`](.python-version), e.g. using [pyenv](https://github.com/pyenv/pyenv).

```sh
$ pyenv install
```

Tell Poetry to use the version of Python currently active in your shell when creating the virtual environment (otherwise it will always use the version it was installed under):

```sh
$ poetry config virtualenvs.prefer-active-python true
```

Install the dependencies (this automatically creates a virtual environment for the project):

```shell
$ make env
```

Copy the environment shadow file and make the necessary changes:

```sh
$ cp .env.shadow .env
```

## Development

A CLI script simulates running the Lambda locally:

```shell
poetry run python dev.py generate-report
```

## Tests

Run the tests:

```shell
make test
```

Update snapshots:

```shell
make test_snapshot_update
```

## Formatting

We use [black](https://black.readthedocs.io/en/stable/) to automatically format our source code.

You can manually trigger formatting by running `make format`, or configure your editor to automatically format on save (e.g. [for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter)). The `make lint` command checks that all the files have been formatted, and will fail if any haven't.

## Deployment

Deployment and PR pipeline run results can be found on [Jenkins](https://pipeline.theorchard.io/job/theorchard/job/lambda-collaborator-report/).
