Install a local, non-root PostgreSQL Server with Python "pip"

Posted on 2021-09-01 by Michel Pelletier
Related Open Source


I'd like to announce the first release of postgresql-wheel, a Python package containing an entire compiled PostgreSQL server in a single pip installable file.

While the pip "wheel" is universally used to package Python code and compiled shared libraries, the format is like other archive formats (apt, yum, etc) and can store any kind of compiled package artifacts, like an entire postgres installation binary.

postgresql-wheel uses the "manylinux" build environments to compile PostgreSQL and include an entire server installation in the wheel. This means you can install a local postgresql server into a virtual environment without any sudo or root privileges.

This package was developed to be useful for test runners that depend on postgresql, just add this wheel as a dependency and create and destroy any number of databases in your setup and teardown code, no external postgres server dependencies required!