From d9fe81d1418fc8e1cc1533ec56d41d3e7d188e29 Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Mon, 8 Jul 2019 14:29:55 +0200
Subject: [PATCH] #78 linux setup #85 loosen strict requirements

---
 .gitlab-ci.yml                                |  7 +++-
 CONTRIBUTING.rst                              |  6 +++
 getting_started/getting_started.bat           |  6 ++-
 ...gettings_started.sh => getting_started.sh} | 38 ++++++++++++-------
 requirements_continuous_integration.txt       | 26 ++++++-------
 requirements_dev.txt                          | 32 ++++++++--------
 6 files changed, 70 insertions(+), 45 deletions(-)
 rename getting_started/{gettings_started.sh => getting_started.sh} (57%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5dd5539..2ed45eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,8 +25,11 @@ tests:
     script:
         - apt update
         - apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev
-        - pip install tox
-        - xvfb-run tox -v --recreate
+#        - pip install tox
+#        - xvfb-run tox -v --recreate
+        - wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh -O /tmp/Anaconda3-5.3.1-Linux-x86_64.sh
+        - bash /tmp/Anaconda3-5.3.1-Linux-x86_64.sh -b -p /tmp/anaconda3
+        - export PATH=/tmp/anaconda3/bin:$PATH; bash getting_started/getting_started.sh
 
 build_and_deploy_docs:
     image: "python:latest"
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 814bc50..dd9500f 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -73,6 +73,12 @@ Ready to contribute? Here's how to set up `flatland` for local development.
     $ cd flatland
     $ pip install -e .
 
+    These steps are performed if you run
+
+    $ getting_started/getting_started.bat/.sh
+
+    from Anaconda prompt. Only prerequisites: git and Anaconda.
+
 
 4. Create a branch for local development::
 
diff --git a/getting_started/getting_started.bat b/getting_started/getting_started.bat
index 03dfcc4..89799bf 100644
--- a/getting_started/getting_started.bat
+++ b/getting_started/getting_started.bat
@@ -30,7 +30,6 @@ call python -m pip install --upgrade pip || goto :error
 python setup.py install || goto :error
 
 # ensure jupyter is installed in the virtualenv
-
 python -m pip install --upgrade -r %FLATLAND_BASEDIR%/requirements_dev.txt -r %FLATLAND_BASEDIR%/requirements_continuous_integration.txt || goto :error
 
 
@@ -41,6 +40,11 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension || goto :error
 jupyter nbextension enable --py --sys-prefix widgetsnbextension || goto :error
 jupyter nbextension install --py --sys-prefix jpy_canvas || goto :error
 jupyter nbextension enable --py --sys-prefix jpy_canvas || goto :error
+
+
+@echo off
+echo "************ RUN JUPYTER NOTEBOOKS *************************"
+@echo on
 jupyter notebook || goto :error
 
 
diff --git a/getting_started/gettings_started.sh b/getting_started/getting_started.sh
similarity index 57%
rename from getting_started/gettings_started.sh
rename to getting_started/getting_started.sh
index 70654ae..0a24578 100644
--- a/getting_started/gettings_started.sh
+++ b/getting_started/getting_started.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash
 set -e # stop on error
 set -x # echo commands
 
@@ -12,27 +12,34 @@ set +x
 echo "************ TESTING PREREQUISITES PYTHON3 + GIT *************************"
 set -x
 
+git --version
+python --version
+conda --version
+echo $PATH
+
 
 set +x
 echo "************ SETUP VIRTUAL ENVIRONMENT FLATLAND *************************"
 set -x
+source deactivate
+(conda info --envs | fgrep flatland-rl) || conda create python=3.6 -y --name flatland-rl
+source activate flatland-rl
 
-export WORKON_HOME=${FLATLAND_BASEDIR}/getting_started/envs
-echo WORKON_HOME=$WORKON_HOME
-echo PWD=$PWD
-mkdir -p ${WORKON_HOME}
-# cannot work with virtualenvwrapper in script
-cd ${WORKON_HOME}
-python3 -m venv flatland
-source flatland/bin/activate
 
 set +x
 echo "************ INSTALL FLATLAND IN THE VIRTUALENV  *************************"
 set -x
-cd ${FLATLAND_BASEDIR}
-python setup.py install
+
+# TODO we should get rid of having to install these packages outside of setup.py with conda!
+conda install -y -c conda-forge cairosvg pycairo
+conda install -y  -c anaconda tk
+python -m pip install --upgrade pip
+
+python ${FLATLAND_BASEDIR}/setup.py install
+
 # ensure jupyter is installed in the virtualenv
-pip install -r ${FLATLAND_BASEDIR}/requirements_dev.txt -r requirements_continuous_integration.txt
+python -m pip install --upgrade -r ${FLATLAND_BASEDIR}/requirements_dev.txt -r requirements_continuous_integration.txt
+
 
 set +x
 echo "************ INSTALL JUPYTER EXTENSION *************************"
@@ -41,4 +48,9 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension
 jupyter nbextension enable --py --sys-prefix widgetsnbextension
 jupyter nbextension install --py --sys-prefix jpy_canvas
 jupyter nbextension enable --py --sys-prefix jpy_canvas
-jupyter notebook
+
+
+set +x
+echo "************ RUN JUPYTER NOTEBOOKS *************************"
+set -x
+jupyter notebook &
diff --git a/requirements_continuous_integration.txt b/requirements_continuous_integration.txt
index 9475e28..a165e67 100644
--- a/requirements_continuous_integration.txt
+++ b/requirements_continuous_integration.txt
@@ -1,17 +1,17 @@
 # contains all additional requirements to run the ```tox .``` in addition to requirements_dev.txt for ```tox -e py36,py37```
-bumpversion==0.5.3
-wheel==0.32.1
-watchdog==0.9.0
-benchmarker==4.0.1
-coverage==4.5.1
-Sphinx==1.8.1
-sphinx-rtd-theme==0.4.3
-flake8==3.7.7
-flake8-eradicate==0.2.0
-twine==1.12.1
-pydeps==1.7.2
-jupyter==1.0.0
+bumpversion>=0.5.3
+wheel>=0.32.1
+watchdog>=0.9.0
+benchmarker>=4.0.1
+coverage>=4.5.1
+Sphinx>=1.8.1
+sphinx-rtd-theme>=0.4.3
+flake8>=3.7.7
+flake8-eradicate>=0.2.0
+twine>=1.12.1
+pydeps>=1.7.2
+jupyter>=1.0.0
 jupyter-core>=4.5.0
 notebook>=5.7.8
-pytest-xvfb==1.2.0
+pytest-xvfb>=1.2.0
 git+https://github.com/who8mylunch/Jupyter_Canvas_Widget.git@bd151ae1509c50b5809944dd3294f58b7b069c86
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 7858de7..ea46eb2 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -1,17 +1,17 @@
 # contains all requirements to run the tests by running ```tox -e py36,py37```
-tox==3.5.2
-twine==1.12.1
-pytest==3.8.2
-pytest-runner==4.2
-numpy==1.16.4
-recordtype==1.3
-xarray==0.11.3
-matplotlib==3.0.2
-Pillow==5.4.1
-CairoSVG==2.3.1
-msgpack==0.6.1
-svgutils==0.3.1
-screeninfo==0.3.1
-pyarrow==0.13.0
-importlib-metadata==0.17
-importlib_resources==1.0.2
+tox>=3.5.2
+twine>=1.12.1
+pytest>=3.8.2
+pytest-runner>=4.2
+numpy>=1.16.4
+recordtype>=1.3
+xarray>=0.11.3
+matplotlib>=3.0.2
+Pillow>=5.4.1
+CairoSVG>=2.3.1
+msgpack>=0.6.1
+svgutils>=0.3.1
+screeninfo>=0.3.1
+pyarrow>=0.13.0
+importlib-metadata>=0.17
+importlib_resources>=1.0.2
-- 
GitLab