README.md 1.66 KB
Newer Older
Lauri Himanen's avatar
Lauri Himanen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# python-common
This repository contains the common components for building a parser for the NOMAD project.

## NOTE
These instructions were tested on Ubuntu 14.04.

## Quick Install
The modules used for parser development are located under the 'nomadcore' package. You can setup this package in any way you like, but a simple installation script 'setup.py' is provided for ease of use. It will install the nomadcore package along with the needed dependencies. You can install the package in development mode by calling the terminal command

```sh
python setup.py develop --user
```

in the folder where setup.py is located. After this the package will be available to import by simply calling 

```python
import nomadcore
```

in python. The development mode also means that the latest version of the code is used, so any updates from git will automatically be available. You can install a static snapshot by using 'install' instead of 'develop'.

## Manual install
This package depends on other python libraries which are declared in 'requirements.txt'. The requirements can be installed simply by calling the terminal command

```sh
pip install -r requirements.txt
Lauri Himanen's avatar
Update  
Lauri Himanen committed
27
```
Lauri Himanen's avatar
Lauri Himanen committed
28 29 30 31 32 33 34 35 36 37 38

in the folder where the file is located. In order to use the nomadcore package you have to add the directory to PYTHONPATH so that python knows where to look for it. This can be achieved temporarily by using a script like this

```python
import sys
dir = os.path.normpath("path/to/python-common/python"))
if not commonDir in sys.path:
    sys.path.insert(0, commonDir)
```

or the addition can be made permanent by adding the line
Lauri Himanen's avatar
Update  
Lauri Himanen committed
39

Lauri Himanen's avatar
Lauri Himanen committed
40 41
```sh
export PYTHONPATH="${PYTHONPATH}:/path/to/python-common/python"
Lauri Himanen's avatar
Update  
Lauri Himanen committed
42
```
Lauri Himanen's avatar
Lauri Himanen committed
43 44

to your ~/.bashrc file.