CUCC Expedition Handbook

Troggle - software development laptop

python logo

Software development machine

For troggle itself, you need a linux machine. We all use Debian or Debian-derived machines (Debian itself, Ubuntu, Xubuntu etc.) but other forms of linux may work. Running Debian or Ubuntu under WSL on Windows 10 works fine.

If you want to work on the troggle source code and be able to commit to the server git repo, your account will need to be added to the troggle project members list. Contact wookey at wookware dot org to get this set up.

This page is a work in progess. Text will be moved here from

http://expo.survex.com/repositories/troggle/.git/tree/README.txt
handbook/computing/yourlaptop.html
handbook/troggle/trogdjangup.html
debian logo

Installing linux

If you don't already know how to do this, then you should probably not be attempting this. But in case you are an experienced linux user who has always had someone else set up the system for them, then Ubuntu is the easiest and more forgiving to install, either directly on the computer or inside WSL. Because we are using fairly old releases of Django, you will want Ubuntu-20.04

and familiarise yourself with the directory structure on the expo server, which we will be duplicating (partly) as docmented in The Expo Server. We are not here doing a full install of all the software and scripts on the server, just the minimum to run, test and debug troggle on django.

WSL on Windows

The standard documentation for Ubuntu or debian below all works, but you should first skim the Windows expo laptop description of WSL1 and WSL2. The default is that WSL2 will be installed, but all our practical experience so far is with WSL1.

Installing python

Python is not installed by default usually, and in any case we need specific versions to be installed. For Ubuntu 20.04 the default is python3.9 but this is incompatible with standard debian Buster, so we also need python3.7, if you are planning on migrating troggle from debian Buster (v10) to Bullseye (v11) then you will also want python3.8 .

sudo apt install python3 python3-pip
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7 python3.7-venv python3.7-doc binutils binfmt-support
sudo apt install sqlite3 sqlite3-doc
sudo apt install survex
cd /usr/bin
sudo ln -s python3 python
sudo ln -s pip3 pip 

You will also definitely need sqlite3 even if you are planning to use another database. Sqlite3 is used by the test harness system.

Note that when you install survex it installs a shed load of packages that it needs.

We do not install django at this point. We will be installing django in a separate virtual environment (a 'venv'), not in the main linux system.

We need to have the folder structure that troggle expects. On your own machine you will have your own logon id, and you do not need to create an 'expo' user, but you do need to create folders where and an 'expo' user would have them. Make links there to wherever you have actually installed the repos. So if you have installed all your repos in /mnt/c/EXPO/, then you would need to do this:

cd ~
cd ..
sudo mkdir expo
cd expo
sudo ln -s /mnt/c/EXPO/expofiles expofiles
sudo ln -s /mnt/c/EXPO/expoweb expoweb
sudo ln -s /mnt/c/EXPO/troggle troggle
sudo ln -s /mnt/c/EXPO/loser loser
sudo ln -s /mnt/c/EXPO/drawings drawings
sudo ln -s /mnt/c/EXPO/expowebcache expowebcache
sudo mkdir expowebcache/3d
cd ..
ls -tlA expo

Installing Django and troggle

django logo

The important point to note here is that unless you are doing something fairly trivial, or you are a git genius, it is sensible to set up a python virtual environments to hold duplicate copies of both troggle and django code. Then you will be able to check very quickly that your edited version of troggle runs with old, current and pre-release versions of python and of django; and you will more easily be able to manage problems with incompatible versions of django plugins as installing and upgrading the dependent packages is very fast.

Installing a venv

We set up a venv specifically for python 3.7 (which is the standard version on our server which is running Buster (debian v10) and django 2.2.19. See the standard python dcoumentation on venv for python 3.7.12. Note that we are creating it as a sibling folder to /troggle/ .

cd ~
cd ../expo
python3.7 -m venv py37d22
cd py37d22
source bin/activate
pip list -o

The last command lists the default packages installed in the venv. This is for comparison later, after we have installed troggle, django and dependencies. You will get a warning that you have an out of date version of pipbut this is as we want: we are using a version of pip appropriate for the older version of python within the venv. troggle logo

The first time you do this you can't complete the pip installation of django as you have not yet got the dependencies - because you have not yet cloned the troggle repo, so the first time it is easiest to just create requirements.txt yourself with a text editor.

cp ../troggle/requirements.txt .
pip install -r requirements.txt
pip list -o
where requirements.txt (note the capitalisation of the listed packages) is:
confusable-homoglyphs==3.2.0
Django==2.2
docutils==0.14
gunicorn==20.1.0
Pillow==5.4.1
pytz==2019.1
sqlparse==0.2.4
Unidecode==1.0.23
This will pick up the latest django 2.2.x available, but all the other dependencies are pinned. These dependencies are as-standard on debian Buster (10) and you will want to experiment with upgrading them for Bullseye (v11).

Pillow is an image handling package used to make the prospecting map (currently disabled, see /prospecting_guide/).
tinymce is the wysiwyg in-browser editor (disabled pending reinstatement)

This is also documented in the updating django for troggle page where it describes upgrading and testing with later versions of django.

If you have not used pip before, read this

Installing troggle

key exchange
Follow this link to register a key with the expo server to get git access.
troggle
The :troggle: repo is the python code that runs troggle and generates 2,000 webpages of reports and tables. This is what you need for software development.cd /home/expo/p37d22
git clone ssh://expo@expo.survex.com/home/expo/troggle
(read/write)

Go on to: Troggle architecture
Return to: Troggle programmers' guide
Troggle index: Index of all troggle documents