Skip to main content

PIICatcher Developer Setup

Download PIICatcher from Github or fork

git clone https://github.com/tokern/piicatcher.git

Install Poetry

Follow instructions on Poetry website

Setup virtualenv

cd piicatcher
poetry shell
poetry install
piicatcher --help

Development in Docker (if failed to install piicatcher directly)

docker build . -t {IMAGE NAME} -f docker/Dockerfile
alias piicatcher='docker run -v {FILE PATH TO PIICATCHER}:/config {IMAGE NAME}'

Setup pre-commit hooks (required if you plan to contribute code)

Pre-commit hooks run the following checks:

  • black
  • mypy
  • flake8
  • isort
pre-commit install -t pre-commit

Setup databases in docker for tests

Install docker and docker-compose.

docker-compose -f test/docker-compose.yml up -d

Check if the container are running:

docker ps

CONTAINER ID IMAGE ... CREATED STATUS PORTS NAMES
8b1798a9307d postgres:13 ... 6 days ago Up 6 days 0.0.0.0:5432->5432/tcp postgres
09775e0d564f ghcr.io/linuxserver/mariadb ... 2 months ago Up 6 days 0.0.0.0:3306->3306/tcp mariadb

Run unit tests

pytest

# Run tests in a specific file
pytest tests/test_cli.py

Run PiiCatcher with local copy of DBCat

  1. Delete instances of DBCat from poetry lock

  2. Uninstall DBCat

    pip uninstall dbcat

  1. Place wheel file of DBCat in the same directory as the docker file

  2. In the pyproject.toml folder, change the directory of DBCat

    dbcat = { path = "/app/{WHEEL}"}

  1. Edit DockerFile

    WORKDIR $PYSETUP_PATH COPY ./poetry.lock ./pyproject.toml ./ COPY ./docker/{WHEEL} /app/{WHEEL} ...

    RUN pip install /app/{WHEEL}