This doc provides details for developers who want to hack on spectrometer. If you have not done so already please refer to the Quick Start Guide.
We follow the Python PEP8 style guide. See: https://www.python.org/dev/peps/pep-0008/
For documentation we follow the Python Documentation Guide. See: https://docs.python.org/devguide/documenting.html
In development we want to install spectrometer so that we can modify the code and use it as if in production with changes taking effect immediately. We can achieve this using pip’s editable install mode.
cd server # From spectrometer repo root
pip install -e .
spectrometer server -c example-config/config.py start
We use tox to manage and run our unit tests. Simply run tox in the server directory to initiate the tests. If you don’t have tox installed typically it is packaged as python-tox in most distros.
cd server/ # From spectrometer repo root
tox
To install NodeJS in your system, use the Node Version Manager (NVM), which allows to co-exist multiple NodeJS versions in the same system.
If you already have NodeJS older versions (<= 0.12), it is strongly recommended to completely remove them and reinstall using NVM.
For Linux systems, you can do the following to remove NodeJS:
which node # Note down the path
sudo rm -r /path/bin/node /path/bin/npm /path/include/node /path/lib/node_modules ~/.npm
Install NVM, NodeJS 4.3.x and NPM:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
nvm install 4.3.1 # By default this installs npm 2.14.x
npm install npm -g # This will upgrade npm to 3.7.x
cd web # From the root of the git repo npm install npm start
Goto `http://localhost:8000`
The web project is configured to hot-reload when any changes are made to the code. Most of the time the web browser should auto refresh, if not simply refresh the page.
Production build does not have Devtools and hot reloading middleware. It also minifies scripts and css.
For Production build, execute the following commands:
npm run build
npm run start-prod
In order to add a new repository to collect statistics, you must make the following changes:
`python spectrometer-server`
and web `npm start`
)