Skip to content

Getting Started with BallotLab

Neil Johnson edited this page Jun 1, 2022 · 3 revisions

BallotLab, a Python project, uses Poetry for dependency management. To get started:

  1. Clone this repo, or create a fork, on your development workstation.
  2. Install Poetry on your development workstation (if needed).
  3. At the command line, use cd to go to the project's root directory in your repo.
  4. Run poetry install to configure your virtual environment and add all the required python packages.
  5. Run poetry shell to invoke the virtual environment.

Developer Tools

The developer tools used in this project were inspired by How to set up a perfect Python project.

TL;DR: here's a summary listing of the bash commands from that article:

cd [vour/repo/directory]
# install pipenv (system-wide)
pip install pipenv
# set up pipenv with python 3.9
pipenv install --python 3.9
# install development tools
pipenv install isort --dev
# currently, black is pre-release so use the --pre flag
pipenv install black --pre --dev  
pipenv install flake8 --dev
pipenv install mypy --dev
pipenv install pytest pytest-cov --dev

Install Required Python Packages

Once you've set up your development environment, install the required Python packages:

# Create PDF ballot files
pipenv install reportlab
# Add images to PDF files (replaces deprecated PIL)
pipenv install pillow
# (optional) extract text from PDFs
pipenv install pdfminer.six

Note that the use of poetry as your package manager, following the steps at the top of this page, will handle all of these dependencies.

Clone this wiki locally