Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

refactor setup_dev_env script (#756)

Edgar Riba5542045ca3e7
diff --git a/Makefile b/Makefile
index 92ecd2188..03f531d24 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ test-cpu: FORCE
test-cuda: FORCE
pytest -v --device cuda --dtype all --cov=kornia test/ --flake8 --mypy
+test-module: FORCE
+ pytest -v --device all --dtype all --cov=kornia test/$(module) --flake8 --mypy
+
lint: FORCE
pytest -v --flake8 -m flake8
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 0954f1808..000000000
--- a/requirements.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# core dependencies
-pytorch==1.6.0
-
-# utils
-torchvision==0.7.0
-opencv
-ipython
-jupyter
-matplotlib
-
-# test
-pytest==5.4.2
-pytest-flake8==1.0.6
-pytest-cov==2.9.0
-pytest-mypy==0.6.2
-autopep8
-pydocstyle
-
-# docs
-sphinx
-sphinx-gallery
-sphinx_rtd_theme
-sphinxcontrib-bibtex
-nbsphinx
-nbconvert
-notebook
diff --git a/setup_dev_env.sh b/setup_dev_env.sh
index 6b908bedf..d3c700c6f 100755
--- a/setup_dev_env.sh
+++ b/setup_dev_env.sh
@@ -36,11 +36,25 @@ fi
# define a python version to initialise the conda environment.
# by default we assume python 3.7.
python_version=${PYTHON_VERSION:-"3.7"}
+pytorch_version=${PYTORCH_VERSION:-"1.6.0"}
+pytorch_mode=${PYTORCH_MODE:-""} # use `cpuonly` for CPU or leave it in blank for GPU
# 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
-
+$conda_bin create --name venv python=$python_version
$conda_bin clean -ya
+
+# activate local virtual environment
+source $conda_bin_dir/activate $dev_env_dir/envs/venv
+
+# install pytorch and torchvision
+conda install pytorch=$pytorch_version torchvision $pytorch_mode -c pytorch
+
+# install testing dependencies
+pip install -r requirements-dev.txt
+
+# install documentation dependencies
+pip install -r docs/requirements.txt
+
+conda deactivate # close the `venv` environment