Debian Codegraph @

continuous_integration/scripts/test_imports.sh

raw
1 #!/usr/bin/env bash
2 set -o errexit
3
4
5 test_import () {
6 echo "Create environment: python=$PYTHON_VERSION $1"
7 # Create an empty environment
8 mamba create -q -y -n test-imports -c conda-forge python=$PYTHON_VERSION packaging pyyaml fsspec toolz partd click cloudpickle importlib-metadata $1
9 conda activate test-imports
10 if [[ $1 =~ "distributed" ]]; then
11 # dask[distributed] depends on the latest version of distributed
12 python -m pip install git+https://github.com/dask/distributed
13 fi
14 python -m pip install -e .
15 mamba list
16 echo "python -c '$2'"
17 python -c "$2"
18 # Ensure that no non-deterministic objects are tokenized at init time,
19 # which can prevent the library from being imported at all.
20 echo "python -c '$2' (ensure deterministic)"
21 DASK_TOKENIZE__ENSURE_DETERMINISTIC=True python -c "$2"
22 conda deactivate
23 mamba env remove -n test-imports
24 }
25
26 test_import "" "import dask, dask.base, dask.multiprocessing, dask.threaded, dask.optimization, dask.bag, dask.delayed, dask.graph_manipulation, dask.layers"
27 test_import "numpy" "import dask.array"
28 test_import "pandas dask-expr" "import dask.dataframe"
29 test_import "bokeh" "import dask.diagnostics"
30 test_import "distributed" "import dask.distributed"