Skip to content

Latest commit

 

History

History
132 lines (99 loc) · 3.69 KB

install.org

File metadata and controls

132 lines (99 loc) · 3.69 KB

Prerequisites

For ROOT export

ROOT is not required to use GeGeDe. It is needed to let GeGeDe directly export to ROOT. Without direct ROOT support one may still generate GDML output with GeGeDe and then transport the GDML output to a different environment that provides ROOT.

See the ROOT home page for definitive instructions on how to install it: https://root.cern.ch/. Here is one particular example used on Ubuntu 18.04:

# (git clone/download source)
$ mkdir root/buildit && cd root/buildit
$ cmake -G Ninja .. -Dcxx17=ON \
  -DCMAKE_INSTALL_PREFIX=$HOME/opt/root \
  -DPYTHON_EXECUTABLE=/usr/bin/python3 \
  -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
  -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m
$ cmake --build . -- -j$(nproc)
$ cmake --build . --target install

Once installed and after entering your Python environment (see below) you may quickly test if PyROOT is available:

$ python --version
(make sure it is Python 3.x)
$ python -c 'import ROOT'
(make sure no errors)

To use ROOT you may need to add/set its library directory to PYTHONPATH. Extending the build example above:

export PYTHONPATH=$HOME/opt/root/lib
export LD_LIBRARY_PATH=$HOME/opt/root/lib

For GDML export

$ sudo apt-get install libxml2 libxslt1-dev

For Pivy/Coin3D/FreeCAD

This is experimental and left as an exercise for the interested.

Installation of GeGeDe

GeGeDe is pure Python. It effectively supports only Python 3 due to its dependencies dropping support for dead Python 2 (RIP). GeGeDe may be installed in “the usual Python ways” and some examples are given below.

Python3 venv

One of the easiest ways to install GeGeDe (or any Python package) is to do so in a virtual environment:

$ python3 -m venv ggdvenv
$ source ggdvenv/bin/activate

At this point, any Python packages you install go into your virtual environment directory, called ”ggdvenv/” here.

If you have ROOT installed, it is likely outside this virtual environment and, you may to explicitly tell Python about it. See above.

Installing GeGeDe

Get the GeGeDe source and install like:

$ git clone https://github.com/brettviren/gegede.git
$ cd gegede/
$ python setup.py install

Development

To set up for building and testing GGD “in source” you may use a virtual environment created as above. An even more convenient way is to use direnv to bind setting up the venv based on cd‘ing to the development area.

$ cd /my/dev/area
$ echo layout python3 > .envrc
$ direnv allow

If you will develop on GeGeDe (or other Python packages), after activating the virtual environment, they should be installed in “editable” or “develop” mode. For example:

$ cd /path/to/my/gegede
$ pip install -e .

If ROOT (PyROOT) will be used then you must let direnv know how to include it by appending this to its configuration file:

$ cd /my/dev/area
$ cat <<EOF >> .envrc
export PYTHONPATH=$HOME/opt/root/lib
export LD_LIBRARY_PATH=$HOME/opt/root/lib
EOF

Testing

GeGeDe comes with a set of unit tests which are meant to be run via pytest. All tests should pass, report failures as bugs on github. Pytest is not a default dependency and must be installed by the user. To exercise the tests, simply run this from the source directory and installation environment:

$ pip install pytest
$ pytest