Settings

Theme

Show HN: Install Postgres with Pip in Virtualenv

github.com

2 points by fforflo 8 months ago · 0 comments · 1 min read

Reader

Hi HN,

I frequently work with Postgres & Python and toggle between multiple versions of each. In Postgres, I keep a separate installation for each project, but I don't like git submodules and don't want to ship "pg_build.sh" scripts with the source code.

So, I built pgvenv as a Python shell package that, when installed, triggers a from-source installation of Postgres and installs it at venv's prefix. Could become handy at times I think.

You can roughly use it like this.

python3.11 -m venv ./venv

source ./venv/bin/activate

PGVERSION=17.4 pip install pgvenv --force-reinstall --no-cache-dir

initdb ./pgdata

postgres -D ./pgdata

Many things can go wrong with this in production, so should probably use for development only.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection