Skip to content

Legacy ‐ Installation for development (old version ‐ before v2)

Matthieu Viry edited this page Jul 4, 2024 · 1 revision

Installation for development

NOTE : The only targeted/tested OS is currently GNU/Linux. However it is very likely that it can work with little change on other UNIX-like (xBSD, MacOS?). An explanation is also for an installation via Docker, which can make a deployment possible for other OS users (notably Windows, FreeBSD or MacOSX)

1/ Installing the required packages on your system

  • Packages provided by apt, based on ubuntu 22.04:
$ sudo apt-get install -y --no-install-recommends \
    software-properties-common gcc g++ \
    libpython3.11-dev python3.11 python3.11-dev python3-pip \
    libgeos-c1v5 libgeos-dev libgdal30 libgdal-dev libspatialindex-dev libffi-dev \
    nodejs npm redis-server libuv1 libuv1-dev unzip wget git \
    libxslt1.1 libxslt1-dev libxml2 libxml2-dev libkml-dev locales \
  • Other tools needed: topojson (required by the application)
$ sudo npm -g install topojson

2/ Option A - Installing for development with no virtual-environment :

Installation / compilation of the extensions :
$ git clone https://github.com/riatelab/magrit
$ cd magrit
$ pip3.11 install -r requirements/dev.txt
$ python3.11 setup.py build_ext --inplace
Launching the redis service :
$ sudo service redis-server start
Installing the required libraries for the client application:

Go in the client folder and run npm install (no need to be root) to install JS dependencies and the various packages required to build the JS code (such as webpack):

$ cd client/
$ npm install
$ cd ..
Launching the server application :

With the --dev argument, js/css files are watched and a transpiled file is automatically built when changes occur.

$ python3.11 magrit_app/app.py -p 9999 --dev
DEBUG:aioredis:Creating tcp connection to ('0.0.0.0', 6379)
INFO:magrit.main:serving on('0.0.0.0', 9999)
....

2/ Option B - Installing for development with a virtual-environment :

Installation / compilation of the extensions :
$ sudo service redis-server start
$ git clone https://github.com/riatelab/magrit
$ cd magrit
$ virtualenv venv -p /usr/bin/python3.11
$ source venv/bin/activate
(venv)$ pip install -r requirements/dev.txt
(venv)$ python setup.py build_ext --inplace
Installing the required libraries for the client application:

Go in the client folder and run npm install (no need to be root) to install JS dependencies and the various packages required to build the JS code (such as webpack) and build manually the JS code the first time :

$ cd client/
$ npm install
$ npm run build
$ cd ..
Launching the application:

With the --dev argument, js/css files are watched and a transpiled file is automatically built when changes occur.

(venv)$ python magrit_app/app.py -p 9999 --dev
DEBUG:aioredis:Creating tcp connection to ('0.0.0.0', 6379)
INFO:magrit.main:serving on('0.0.0.0', 9999)
....

3/ Development

When started with --dev argument the application automatically transpile JavaScript files when modified.
If changes relate to the python application you have to restart it for them to be taken into account.