Skip to content



Use unix line endings.

Setup your development environment

  1. Install pyenv for your system to use the correct version of python specified in .python-version. Make sure your $PATH now includes ~/.pyenv/bin && ~/.pyenv/shims.

  2. Install pyenv-virtualenv to isolate project dependencies which keeps requirements.txt clean and frozen.

  3. Install the version of python listed in .python-version:

$ pyenv install 3.10.4

Create the virtual env:

$ pyenv virtualenv 3.10.4 pgml-dashboard

Install the dependencies:

$ pip install -r requirements.txt

If you ever add new dependencies, freeze them:

$ pip freeze > requirements.txt

Make sure requirements.txt has no changes, which indicates your virtual environment is setup correctly.

$ git status

Setup your .env:

$ cp .env.TEMPLATE .env
$ nano .env

Run the server:

$ ./ runserver

Maintain your development database

How to reset your local database:

$ psql -c "DROP DATABASE pgml_development" postgres://postgres@
$ psql -c "CREATE DATABASE pgml_development" postgres://postgres@
$ psql -c "CREATE SCHEMA pgml" postgres://postgres@

Follow the installation instructions to create a local working Postgres environment, then install the pgml-extension from the git repository:

cd pgml-extension
sudo python3 install
sudo python3 -m pgml_extension --database-url=postgres://postgres@localhost:5433/pgml_development

Run the tests from the root of the repo:

cd pgml-extension
ON_ERROR_STOP=1 psql -f tests/test.sql postgres://postgres@

One liner:

cd pgml-extension; sudo /bin/pip3 install .; psql -c "DROP DATABASE pgml_development" postgres://postgres@; psql -c "CREATE DATABASE pgml_development" postgres://postgres@; psql -c "create schema pgml" postgres://postgres@; sudo python3 -m pgml_extension --database-url=postgres://postgres@localhost:5433/pgml_development; ON_ERROR_STOP=1 psql -f tests/test.sql -P pager postgres://postgres@; cd ..

Make sure to run it exactly like this, from the root directory of the repo.

Update documentation

  • mkdocs serve - Start the live-reloading docs server.
  • mkdocs build - Build the documentation site.
  • mkdocs -h - Print help message and exit.