Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add requirements.txt and clean setup_dev_env.sh

edgarriba3b3c5a5dc804
diff --git a/.circleci/config.yml b/.circleci/config.yml
index b1414a9ad..18b7834c8 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -5,13 +5,12 @@ common: &common
steps:
- checkout
- run:
- name: run setup-dev-env
+ name: install dependencies
command: ./setup_dev_env.sh
- run:
name: activate enviroment
command: |
source path.bash.inc
- echo "source .dev_env/bin/activate" >> $BASH_ENV
- run:
name: install package
command: make install
diff --git a/path.bash.inc b/path.bash.inc
index 53dfaef4d..9485d9f27 100644
--- a/path.bash.inc
+++ b/path.bash.inc
@@ -11,5 +11,12 @@ sdk_dir="$(cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"
if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then
$sdk_dir/setup_dev_env.sh
fi
-source $sdk_dir/.dev_env/bin/activate $sdk_dir/.dev_env/venv
+
+cmd="source $sdk_dir/.dev_env/bin/activate $sdk_dir/.dev_env/envs/venv"
+if [ -z $CI ]; then
+ eval $cmd
+else
+ echo $cmd >> $BASH_ENV
+fi
+
export PYTHONPATH=$PYTHONPATH:$sdk_dir
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000000000..2b3392dd3
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,25 @@
+# core dependencies
+pytorch==1.2.0
+
+# utils
+torchvision==0.4.0
+opencv==4.1.1
+ipython==7.8.0
+jupyter==1.0.0
+matplotlib==3.1.1
+
+# test
+pytest==5.1.2
+pytest-cov==2.7.1
+flake8==3.7.8
+autopep8==1.4.4
+mypy==0.720
+mypy_extensions==0.4.1
+
+# docs
+sphinx==2.1.2
+sphinx_rtd_theme=0.4.3
+sphinxcontrib-bibtex==0.4.2
+nbsphinx==0.4.2
+nbconvert==5.5.0
+notebook==6.0.1
diff --git a/setup_dev_env.sh b/setup_dev_env.sh
index 1048e4150..8aa3ebb66 100755
--- a/setup_dev_env.sh
+++ b/setup_dev_env.sh
@@ -6,48 +6,32 @@ if [ "$apparent_sdk_dir" == "$script_link" ]; then
fi
sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"
-mkdir -p $sdk_dir/.dev_env
+# create root directory to install miniconda
+dev_env_dir=$sdk_dir/.dev_env
+mkdir -p $dev_env_dir
-if [ ! -e $sdk_dir/.dev_env/miniconda.sh ]; then
- curl -o $sdk_dir/.dev_env/miniconda.sh \
+# define miniconda paths
+conda_bin_dir=$dev_env_dir/bin
+conda_bin=$conda_bin_dir/conda
+
+# download and install miniconda
+if [ ! -e $dev_env_dir/miniconda.sh ]; then
+ curl -o $dev_env_dir/miniconda.sh \
-O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- chmod +x $sdk_dir/.dev_env/miniconda.sh
+ chmod +x $dev_env_dir/miniconda.sh
fi
-if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then
- $sdk_dir/.dev_env/miniconda.sh -b -u -p $sdk_dir/.dev_env
+if [ ! -e $conda_bin ]; then
+ $dev_env_dir/miniconda.sh -b -u -p $dev_env_dir
fi
-# create an environment with a specific python version
-PYTHON_VERSION=${PYTHON_VERSION:-"3.7"}
-$sdk_dir/.dev_env/bin/conda create --name venv python=$PYTHON_VERSION
-
-if [ $CI != true ]; then
-# Install CPU-PyTorch
-$sdk_dir/.dev_env/bin/conda install -y \
- pip \
- ipython \
- jupyter \
- matplotlib \
- numpy \
- pytorch-nightly \
- torchvision \
- opencv \
- -c pytorch
-else
-# Install CPU-PyTorch
-$sdk_dir/.dev_env/bin/conda install -y \
- pytorch-nightly-cpu \
- -c pytorch
-fi
+# define a python version to initialise the conda environment.
+# by default we assume python 3.7.
+python_version=${PYTHON_VERSION:-"3.7"}
-$sdk_dir/.dev_env/bin/conda install -y \
- pytest \
- pytest-cov \
- flake8 \
- autopep8 \
- mypy \
- mypy_extensions \
- --file docs/requirements.txt \
- -c conda-forge
+# create an environment with the specific python version
+$conda_bin config --append channels conda-forge
+$conda_bin config --append channels pytorch
+$conda_bin update -n base -c defaults conda
+$conda_bin create --name venv --file requirements.txt python=$python_version
-$sdk_dir/.dev_env/bin/conda clean -ya
+$conda_bin clean -ya