Skip to content
Snippets Groups Projects
Commit 745316c6 authored by Laurent COLBOIS's avatar Laurent COLBOIS
Browse files

Add entry point and doc

parent 170b17b1
No related branches found
No related tags found
1 merge request!298Add script to install CI versions of all external Bob dependencies
...@@ -4,24 +4,26 @@ import click ...@@ -4,24 +4,26 @@ import click
@click.command( @click.command(
epilog="""Example: epilog="""Example:
1. Creates an environment called `myenv' containing all external bob dependencies:
python bob/devtools/scripts/install_deps.py myenv Creates an environment called `myenv' based on Python 3.8 and containing all external bob dependencies:
2. The version of python to solve with can be provided as option:
python bob/devtools/scripts/install_deps.py myenv --python=3.8
bdt dev dependencies --python 3.8 myenv
""" """
) )
@click.argument("env_name", nargs=1) @click.argument("env_name", nargs=1)
@click.option("--python", required=True, help="Python version to pin, e.g. 3.8") @click.option("--python", required=True, help="Python version to pin, e.g. 3.8")
def install_deps(env_name, python): def dependencies(env_name, python):
"""Creates an environment with all external bob dependencies."""
import subprocess import subprocess
import pkg_resources
from bob.devtools.build import load_packages_from_conda_build_config from bob.devtools.build import load_packages_from_conda_build_config
conda_config_path = "bob/devtools/data/conda_build_config.yaml" conda_config_path = pkg_resources.resource_filename(
"bob.devtools", "data/conda_build_config.yaml"
)
packages, package_names_map = load_packages_from_conda_build_config( packages, package_names_map = load_packages_from_conda_build_config(
conda_config_path, {"channels": []}, with_pins=True conda_config_path, {"channels": []}, with_pins=True
...@@ -40,7 +42,10 @@ def install_deps(env_name, python): ...@@ -40,7 +42,10 @@ def install_deps(env_name, python):
env_name, env_name,
f"python={python}", f"python={python}",
] ]
+ packages, + packages
+ [
"compilers"
], # Install conda-forge compilers for compiled pacakges
check=True, check=True,
) )
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
...@@ -49,4 +54,4 @@ def install_deps(env_name, python): ...@@ -49,4 +54,4 @@ def install_deps(env_name, python):
if __name__ == "__main__": if __name__ == "__main__":
install_deps() dependencies()
...@@ -118,7 +118,12 @@ bdt dev install -n bobbioface src/bob.bio.base ...@@ -118,7 +118,12 @@ bdt dev install -n bobbioface src/bob.bio.base
bdt dev new -vv bob/bob.newpackage "John Doe" "joe@example.com" bdt dev new -vv bob/bob.newpackage "John Doe" "joe@example.com"
# edit the conda/meta.yaml and requirements.txt files to add your dependencies # edit the conda/meta.yaml and requirements.txt files to add your dependencies
bdt dev create --python 3.9 bobnewpackage bdt dev create --python 3.9 bobnewpackage
bdt install -n bobnewpackage .""" bdt install -n bobnewpackage .
\b
# create an environment with all external bob dependencies
bdt dev dependencies --python 3.9 my_env
"""
) )
def dev(): def dev():
"""Development scripts""" """Development scripts"""
......
...@@ -36,12 +36,23 @@ assume you have ``bob.devtools`` installed on a conda environment named ``bdt`` ...@@ -36,12 +36,23 @@ assume you have ``bob.devtools`` installed on a conda environment named ``bdt``
$ bdt dev create -vv dev $ bdt dev create -vv dev
$ conda activate dev $ conda activate dev
If you know that you plan to develop many packages (or even every Bob package), you can
also instead create an environment that contains the integrality of external dependencies.
This avoids the need to run ``bdt dev create`` for many packages. You will need to pick a Python version:
.. code-block:: sh
$ bdt dev dependencies --python 3.9 dev
$ conda activate dev
.. note:: .. note::
``bdt`` might try to install the cuda version of deep learning packages. If ``bdt`` might try to install the cuda version of deep learning packages. If
you don't have cuda drivers installed and face errors such as ``nothing you don't have cuda drivers installed and face errors such as ``nothing
provides __cuda``, you might need to run: ``export CONDA_OVERRIDE_CUDA=11.6`` provides __cuda``, you might need to run: ``export CONDA_OVERRIDE_CUDA=11.6``
where instead of ``11.6`` you should put the latest version of cuda. where instead of ``11.6`` you should put the latest version of cuda.
You can also use this trick if you actually want to ensure ``bdt`` will
install the cuda version of deep learning packages.
* Build the package using pip: * Build the package using pip:
...@@ -243,6 +254,19 @@ and install ``bob.extension`` as following: ...@@ -243,6 +254,19 @@ and install ``bob.extension`` as following:
$ bdt dev install -n dev src/bob.extension $ bdt dev install -n dev src/bob.extension
If you want to develop many packages, or even all Bob packages at once, you can proceed a bit
differently. First, create an environment containing all external Bob dependencies.
.. code-block:: sh
$ bdt dev dependencies --python 3.9 bob_deps
$ conda activate bob_deps
$ mkdir -pv bob_beta/src
$ cd bob_beta/src
$ bdt dev checkout --use-ssh bob.extension bob.io.base bob.pipelines # ... checkout all packages you need
$ bdt dev install bob.extension bob.io.base bob.pipelines # ... install all packages you need
.. _bob.devtools.create_package: .. _bob.devtools.create_package:
Local development of a new package Local development of a new package
......
...@@ -112,6 +112,7 @@ setup( ...@@ -112,6 +112,7 @@ setup(
"create = bob.devtools.scripts.create:create", "create = bob.devtools.scripts.create:create",
"install = bob.devtools.scripts.development:install", "install = bob.devtools.scripts.development:install",
"checkout = bob.devtools.scripts.development:checkout", "checkout = bob.devtools.scripts.development:checkout",
"dependencies = bob.devtools.scripts.dependencies:dependencies",
], ],
}, },
classifiers=[ classifiers=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment