From ec42373df6921fe671a87c0b00da1aad71e42d85 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Fri, 13 May 2022 15:15:41 +0200
Subject: [PATCH] update docs for mamba and bob-devel

---
 bob/devtools/data/conda_build_config.yaml | 45 -----------------------
 conda/meta.yaml                           |  1 +
 doc/development.rst                       |  6 +--
 doc/install.rst                           | 16 +++++---
 doc/links.rst                             |  2 +
 doc/templates.rst                         | 38 +++++--------------
 6 files changed, 26 insertions(+), 82 deletions(-)

diff --git a/bob/devtools/data/conda_build_config.yaml b/bob/devtools/data/conda_build_config.yaml
index ca99d2c7..7c1b96ae 100644
--- a/bob/devtools/data/conda_build_config.yaml
+++ b/bob/devtools/data/conda_build_config.yaml
@@ -341,8 +341,6 @@ package_names_map:
   pytorch_lightning: pytorch-lightning
 
 
-boost:
-  - 1.77.0
 click:
   - 8.0.4
 click_plugins:
@@ -365,45 +363,24 @@ docker_py:
   - 5.0.3
 docopt:
   - 0.6.2
-ffmpeg:
-  - 4.3.2
 flaky:
   - 3.7.0
 font_ttf_dejavu_sans_mono:
   - 2.37
 freetype:
   - 2.10.4
-giflib:
-  - 5.2.1
 graphviz:
   - 2.50.0
 h5py:
   - 3.6.0
-hdf5:
-  - 1.12.1
 imageio:
   - 2.16.1
 imageio_ffmpeg:
   - 0.4.5
-jinja2:
-  - 3.0.3
-jpeg:
-  - 9e
-jsonschema:
-  - 4.4.0
-libblitz:
-  - 1.0.2
-libpng:
-  - 1.6.37
-libtiff:
-  - 4.3.0
 make:
   - 4.3
 matplotlib:
   - 3.5.1
-mkl:  # [x86 or x86_64]
-  - 2022.0.1  # [linux and (x86 or x86_64)]
-  - 2022.0.0  # [osx and (x86 or x86_64)]
 ncurses:
   - 6.3
 nose:
@@ -424,18 +401,8 @@ pkg_config:
   - 0.29.2
 psutil:
   - 5.9.0
-psycopg2:
-  - 2.9.3
 pybind11:
   - 2.9.1
-pyopengl:
-  - 3.1.6
-pyqt:  # [not arm64]
-  - 5.12.3  # [not arm64]
-pyqtgraph:
-  - 0.12.3
-pytables:
-  - 3.7.0
 pytest:
   - 7.0.1
 pytest_cov:
@@ -447,14 +414,8 @@ pytorch:
   - 1.10.2  # [osx]
 pytorch_lightning:
   - 1.6.0
-pyyaml:
-  - 6.0
 pyzmq:
   - 22.3.0
-qdarkstyle:
-  - 3.0.3
-qtpy:
-  - 2.0.1
 requests:
   - 2.27.1
 schema:
@@ -471,16 +432,10 @@ simplejson:
   - 3.17.6
 six:
   - 1.16.0
-sox:
-  - 14.4.2
 sphinx:
   - 4.4.0
 sphinx_rtd_theme:
   - 1.0.0
-sphinxcontrib_httpdomain:
-  - 1.8.0
-sphinxcontrib_mermaid:
-  - 0.7.1
 sphinxcontrib_programoutput:
   - 0.16
 sqlalchemy:
diff --git a/conda/meta.yaml b/conda/meta.yaml
index fbcf008c..cbeef839 100644
--- a/conda/meta.yaml
+++ b/conda/meta.yaml
@@ -54,6 +54,7 @@ requirements:
     - python-graphviz
     - pip
     - webdavclient3
+    - pre-commit
 
 test:
   requires:
diff --git a/doc/development.rst b/doc/development.rst
index a66a3f11..9dfb237c 100644
--- a/doc/development.rst
+++ b/doc/development.rst
@@ -194,11 +194,11 @@ You can see what is installed in your environment:
 
    $ conda list
 
-And you can install new packages using conda:
+And you can install new packages using mamba:
 
 .. code-block:: sh
 
-   $ conda install <package>
+   $ mamba install <package>
 
 .. note::
 
@@ -290,7 +290,7 @@ your environment. You can find these dependencies by checking
 
 .. code-block:: sh
 
-    $ conda install gcc_linux-64 gxx_linux-64 libblitz
+    $ mamba install gcc_linux-64 gxx_linux-64 libblitz
     $ bdt dev install src/bob.extension src/bob.io.base  # the order of installing dependencies matters!
 
 .. include:: links.rst
diff --git a/doc/install.rst b/doc/install.rst
index 46d56803..e6aec990 100644
--- a/doc/install.rst
+++ b/doc/install.rst
@@ -7,16 +7,16 @@
  Installation
 ==============
 
-You can install this package via conda_, simply pointing to our beta channel.
+You can install this package via conda_ or mamba_, simply pointing to our beta channel.
 We provide packages for both 64-bit Linux and MacOS, for Python 3.8+.
 
 .. code-block:: sh
 
-   $ conda install -n base -c https://www.idiap.ch/software/bob/conda/label/beta -c conda-forge bob.devtools
+   $ mamba install -n base -c https://www.idiap.ch/software/bob/conda/label/beta -c conda-forge bob.devtools
 
 .. warning::
 
-   Some commands from this package will use the ``conda`` CLI to install
+   Some commands from this package will use the ``mamba`` CLI to install
    packages on new environments.
 
    If you install bob.devtools on another environment which is not ``base``, a
@@ -24,17 +24,23 @@ We provide packages for both 64-bit Linux and MacOS, for Python 3.8+.
    duplicating the size of your conda installation.  For this reason, we
    recommend you install this package on the ``base`` environment.
 
-You must also create an alias for ``bdt`` because some commands require another
-conda environment to be activated:
+Installing bob.devtools will create a terminal command called ``bdt`` which you
+must create an alias for it because some ``bdt`` commands require another conda
+environment to be activated. Moreover, development of Bob packages depend on
+pre-commit_ (pre-commit gets installed as a dependency of bob.devtools) so you
+will need an alias for that as well:
 
 .. code-block:: sh
 
    $ conda activate base
    $ echo "alias bdt=$(which bdt)" >> ~/.bashrc
+   # you will also need pre-commit which gets installed when you install bob.devtools
+   $ echo "alias pre-commit=$(which pre-commit)" >> ~/.bashrc
    $ source ~/.bashrc
    # test if it works
    $ conda deactivate
    $ bdt --help
+   $ pre-commit --help
 
 .. _bob.devtools.install.setup:
 
diff --git a/doc/links.rst b/doc/links.rst
index 6a5cb7f2..53387a73 100644
--- a/doc/links.rst
+++ b/doc/links.rst
@@ -3,6 +3,8 @@
 .. Place here references to all citations in lower case
 
 .. _conda: https://conda.io
+.. _mamba: https://mamba.readthedocs.io/
+.. _pre-commit: https://pre-commit.com/
 .. _bob: https://www.idiap.ch/software/bob
 .. _beat: https://www.idiap.ch/software/beat
 .. _shell executor: https://docs.gitlab.com/runner/executors/shell.html
diff --git a/doc/templates.rst b/doc/templates.rst
index 089591ab..2e5b159a 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -434,11 +434,6 @@ you should perform some extra steps:
       python_graphviz: python-graphviz
       scikit_image: scikit-image
       scikit_learn: scikit-learn
-      sphinxcontrib_httpdomain: sphinxcontrib-httpdomain
-      sphinxcontrib_mermaid: sphinxcontrib-mermaid
-      sphinxcontrib_programoutput: sphinxcontrib-programoutput
-      zc_buildout: zc.buildout
-      zc_recipe_egg: zc.recipe.egg
 
 
     boost:
@@ -464,36 +459,21 @@ Updating a dependency version
 
 All dependencies versions are listed in
 ``bob/bob.devtools/bob/devtools/data/conda_build_config.yaml`` to ensure that
-all bob packages use compatible versions of those dependencies. When updating
-(or adding a new) dependency, you must make sure that the new version doesn't
-conflicts with **all** other dependencies. Often, a newest verion of your
-dependency has newer requirements for its own dependencies, which can conflict
-with the rest of ``bob`` dependencies. Therefore it is often best to update all
-dependencies at once, not just one. To do so, ask ``conda`` to create an
-environment with all ``bob`` dependencies:
+all bob packages use compatible versions of those dependencies. This file cannot
+be modified by hand and there is no way to update just one dependency. A script
+is provided to update dependency versions and you have to use that:
 
 .. code-block:: bash
 
-  conda create -n bob_deps --dry-run --override-channels --strict-channel-priority \\
-  -c http://www.idiap.ch/software/bob/conda \\
-  -c conda-forge \\
-  python=3.8 \\ # fix the python version
-  click-plugins cmake coverage dask ... [all bob dependencies]
-
-The versions solved by ``conda`` should be the newest compatible ones you can
-use. If you require a specific version of a dependency, say ``h5py`` you can
-specify only that version in the ``conda`` command and let conda solve the
-rest. Note that you have to update the pinned version of all packages at once
-according to the ``conda create`` output. It is not possible to just update
-the version of one dependency alone.
+    $ git clone git@gitlab.idiap.ch:bob/bob.devtools.git
+    $ cd bob.devtools
+    $ python bob/devtools/scripts/update_pins.py --help
 
 .. note::
 
-  '.' or '-' in package names are changed to '_' in the
-  ``conda_build_config.yaml`` file. Make sure to use the real packages name in
-  the ``conda`` command. Moreover, please remember to update the
-  ``package_names_map`` field if you add a new dependecy with `.` or  `-` in its
-  name.
+  If you are adding a new package and it has '.' or '-' in its pacakge name, you
+  must list it in the ``package_names_map`` block of the
+  ``conda_build_config.yaml`` file.
 
 
 Conda recipe
-- 
GitLab