Closed christopherkeim closed 8 months ago
@christopherkeim Thank you so much for this PR. Can you please tag me once you want me to review it?
@christopherkeim Thank you so much for this PR. Can you please tag me once you want me to review it?
Yes absolutely 🚀 .
@christopherkeim If possible can you add windows equivalent set-up files & github actions for tests on each platform?
It's definitely possible to write a PowerShell script to handle automated Windows development environment setup, but there's two considerations to make:
setup.sh
script gives us the ability to test source code during development, a prototype for system dependencies, and flexibility for VM deployment, but the end dependency for our server is likely going to be Docker
/ Docker Compose
In terms of cross-platform CI (Windows and Linux) - it's possible to create a matrix build that would spin up two separate VMs in parallel and test the source code installation, linting, and functionality etc. in the two separate operating systems. In terms of resources this requires:
setup.sh
and setup.ps
) that must be maintained in parallel as aboveOverall my recommendation is to maintain as much parity with our deployment target environment as possible, where containerization gives us streamlined flexibility for execution across platforms (Linux, Windows, Darwin) - but it depends on what your aims are:
setup.sh
and setup.ps
which I could pull into our CI matrix build Github Action)
Description
This migrates the application's package management to use Poetry 1.5.1 and adds infrastructure for automated development environment setup for Ubuntu 20.04/22.04 machines.
Poetry
Maintains parity with
requirements.txt
- two optional dependency groups have been created for thepsycopg2
PostgreSQL Python module.The
dev
dependency group includes development modules for linting, formatting, and testing, as well as the precompiled psycopg2 binary for interfacing with PostgreSQL databases.The
prod
dependency group includes the production version ofpsycopg2
which will be build from source. This is primarily for Docker image builds, where we will configure the image with dependencies to buildpsycopg2
.psycopg2
official documentation for recommendations on using the source build for production https://www.psycopg.org/docs/install.html#build-prerequisitespython3-dev
and / orlibpq-dev
to build the module from source in our Docker image - we'll explore this ad-hoc https://stackoverflow.com/questions/20863295/how-do-i-install-psycopg2-for-python-3-xFor development, packages can be installed with:
poetry install --with dev
For production (most likely in the Docker build), dependencies can be installed with:
poetry install --with prod
Automated Development Environment Setup (Ubuntu 20.04/22.04)
The
setup.sh
script installs and configures:Each command in the setup is idempotent.
After cloning this repository, the script can be run with:
Motivation and Context
Closes #28
How Has This Been Tested?
Testing on Ubuntu 20.04/22.04 passes with successful installation of system dependencies (Python 3.11, Poetry 1.5.1, PostgreSQL 16, Docker 24.0.6) and Python application dependencies defined in the
pyproject.toml
file using Poetry.With these configurations, the server spins up successfully.
Testing with a local database also passes.
Dependencies Added:
The dependencies added during the migration are:
Types of changes
Checklist:
@unna97