Ad hoc (for now) analyses of Nightscout data for personal use
-
Clone this repo.
-
Install/update pyenv and Python 3.9.13 if needed, e.g.:
brew update && brew upgrade pyenv pyenv install 3.9.13Follow pyenv's instructions for adding to the appropriate rc file, reload the shell, and navigate to the project root. The project's
.python-versionfile specifies the appropriate Python version, which you can confirm usingwhich python. -
Create and activate a virtual environment using
venv:$ python -m venv nsenv -
From within the virtual environment, install dependencies:
$ . nsenv/bin/activate (nsenv) $ pip install -r requirements.txt -
Install pre-commit so that basic formatting will be enforced upon committing to the repo:
pre-commit install -t pre-push -
Create a
.envfile in the project root with the contents:NIGHTSCOUT_URL=https://<your_nightscout_url>/api/v1/ -
You should now be able to run:
(mmenv) $ python demo.py
- This app is currently deployed via Heroku at https://nightscout-analysis.herokuapp.com/. It would be easy to set up review apps (automatic deployment of PR branches) if helpful in the future.
- Keep the
runtime.txtand.python-versionsynced;runtime.txtis used by Heroku to determine the appropriate Python version. - Heroku uses the
Procfilewhich refers toserveras defined inapp.py.