diff --git a/doc/install.rst b/doc/install.rst index 2f14ba7a1824b4ac52f04b37d682563e6803a7cd..dd3565961960bf45971c171406962f80894c2161 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -8,54 +8,60 @@ Installation ============== -We support two installation modes, through pip_, or mamba_ (conda). +Installation may follow one of three paths: deployment for CPU-only execution, +development, or mixed development/deployment with Nvidia CUDA support. Choose +the relevant tab for details on each of those installation paths. +.. tab:: CPU only deployment -.. tab:: pip + Install using pip_, or your preferred Python project management solution (e.g. + uv_, rye_ or poetry_). - Stable, from PyPI: + **Stable** release, from PyPI: .. code:: sh pip install mednet + mednet info - Latest beta, from GitLab package registry: + **Latest** development branch, from its git repository: .. code:: sh - pip install --pre --index-url https://gitlab.idiap.ch/api/v4/groups/software/-/packages/pypi/simple --extra-index-url https://pypi.org/simple mednet - - .. tip:: - - To avoid long command-lines you may configure pip to define the indexes and - package search priorities as you like. + pip install git+https://gitlab.idiap.ch/biosignal/software/mednet@main + mednet info -.. tab:: mamba/conda +.. tab:: Development - Stable: + Checkout the repository, and then use pixi_ to setup a full development + environment: .. code:: sh - mamba install -c https://www.idiap.ch/software/biosignal/conda -c conda-forge mednet - - Latest beta: - - .. code:: sh - - mamba install -c https://www.idiap.ch/software/biosignal/conda/label/beta -c conda-forge mednet + git clone git@gitlab.idiap.ch:biosignal/software/mednet + pixi install --frozen + pixi run mednet info .. tip:: - To force-install Nvidia GPU support on Linux machines, execute: + The ``--frozen`` flag will ensure that the latest lock-file available + with sources is used. If you'd like to update the lock-file to the + latest set of compatible dependencies, remove that option. - .. code:: sh - $ mamba install pytorch-gpu +.. tab:: CUDA - # or, to force the Nvidia CUDA version (environments w/o Nvidia setup): + Checkout the repository on a **CUDA-enabled machine**, then use pixi_ to + create a mixed deployment and development environment for the checkout: + + .. code:: sh - $ CONDA_OVERRIDE_CUDA=12.0 mamba install 'pytorch-gpu=*=cuda118*' + git clone git@gitlab.idiap.ch:biosignal/software/mednet + ln -s pixi-cuda.toml pixi.toml + rm -rf .pixi pixi.lock # clean-up any previous CPU-only install + pixi install + pixi run mednet info .. _mednet.setup: diff --git a/doc/links.rst b/doc/links.rst index a692f286e9317c7aebe80976ef1cfa9e3802c085..674f4bb500b8ca26df0404e928d17ead853c1453 100644 --- a/doc/links.rst +++ b/doc/links.rst @@ -12,7 +12,10 @@ .. _conda: https://conda.io .. _python: http://www.python.org .. _pip: https://pip.pypa.io/en/stable/ -.. _mamba: https://mamba.readthedocs.io/en/latest/index.html +.. _uv: https://github.com/astral-sh/uv +.. _rye: https://github.com/astral-sh/rye +.. _poetry: https://python-poetry.org +.. _pixi: https://pixi.sh .. _pytorch: https://pytorch.org .. _lightning: https://lightning.ai diff --git a/pixi-cuda.toml b/pixi-cuda.toml index 4c978eb200527f5115e646be44f90c24b4867f3c..469377b2a76f3d6631f72d61003c3a7e1e610574 100644 --- a/pixi-cuda.toml +++ b/pixi-cuda.toml @@ -19,12 +19,6 @@ # $ ln -s pixi-cuda.toml pixi.toml # $ rm -rf .pixi pixi.lock # clean-up # $ pixi install # this will install all support libraries -# $ pixi run build # this may fail, see next -# -# If `pixi run build` does not work (in the case you are building on a machine -# w/o CUDA support), then do the following: -# -# $ uv pip install --no-build-isolation --no-deps --editable ../mednet [project] name = "mednet" @@ -58,10 +52,9 @@ pytorch-cuda = { version = "12.1.*", channel = "pytorch" } [host-dependencies] hatch = "*" versioningit = "*" -uv = "*" [system-requirements] cuda = "12.1" -[tasks] -build = "uv pip install --no-build-isolation --no-deps --editable ../mednet" +[pypi-dependencies] +mednet = { path = ".", editable = true } diff --git a/pixi.lock b/pixi.lock index 72d3150d13b63a8382f6d2e88c5ca19ac992e6f4..e0419f7a4de71a9bf6f0dc046646ed3e8cc8c5af 100644 --- a/pixi.lock +++ b/pixi.lock @@ -687,6 +687,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.11-hd590300_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.8.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.1-h166bdaf_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/auto-intersphinx-1.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-auth-0.7.16-h79b3bcb_6.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-cal-0.6.10-hb29e0c7_1.conda @@ -738,6 +739,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/docutils-0.20.1-py312h7900ff3_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/expat-2.6.2-h59595ed_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fancycompleter-0.9.1-py312h7900ff3_1007.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-6.1.1-gpl_h8007c5b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -922,6 +924,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/p11-kit-0.24.1-hc5aa10d_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.43-hcad00b1_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/pillow-10.3.0-py312hdcec9eb_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.43.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.2.0-pyhd8ed1ab_0.conda @@ -943,6 +946,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt-5.15.9-py312h949fe66_5.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt5-sip-12.12.2-py312h30efb56_5.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyrepl-0.9.0-py312h98912ed_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -1016,6 +1020,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-20.25.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/xcb-util-0.4.0-hd590300_1.conda @@ -1054,6 +1059,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/absl-py-2.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/alabaster-0.7.16-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aom-3.8.2-h078ce10_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/auto-intersphinx-1.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-auth-0.7.16-h51b92d1_6.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-cal-0.6.10-hf888d4c_1.conda @@ -1104,6 +1110,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/docutils-0.20.1-py312h81bd7bf_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/expat-2.6.2-hebf3989_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/fancycompleter-0.9.1-py312h81bd7bf_1007.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ffmpeg-6.1.1-gpl_h31ea89b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -1253,6 +1260,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/p11-kit-0.24.1-h29577a5_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pcre2-10.43-h26f9a81_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pillow-10.3.0-py312h8a801b1_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pixman-0.43.4-hebf3989_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.2.0-pyhd8ed1ab_0.conda @@ -1270,6 +1278,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.17.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyrepl-0.9.0-py312he37b823_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -1340,6 +1349,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-20.25.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x264-1!164.3095-h57fd34a_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x265-3.5-hbc6ce65_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/xdg-6.0.0-pyhd8ed1ab_0.conda @@ -3193,6 +3203,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.11-hd590300_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.8.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.1-h166bdaf_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-auth-0.7.16-h79b3bcb_6.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-cal-0.6.10-hb29e0c7_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-common-0.9.13-hd590300_0.conda @@ -3234,6 +3245,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.13.6-h5008d03_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/expat-2.6.2-h59595ed_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fancycompleter-0.9.1-py311h38be061_1007.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-6.1.1-gpl_h8007c5b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.4-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -3419,6 +3431,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/p11-kit-0.24.1-hc5aa10d_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.43-hcad00b1_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/pillow-10.3.0-py311h18e6fac_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.43.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.4.0-pyhd8ed1ab_0.conda @@ -3433,9 +3446,11 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.14-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-hb77b528_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/py-opencv-4.9.0-py311hf95f699_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.17.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt-5.15.9-py311hf0fb5b6_5.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt5-sip-12.12.2-py311hb755f60_5.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyrepl-0.9.0-py311h459d7ec_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -3489,6 +3504,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.2.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/xcb-util-0.4.0-hd590300_1.conda @@ -3526,6 +3542,7 @@ environments: osx-arm64: - conda: https://conda.anaconda.org/conda-forge/noarch/absl-py-2.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aom-3.8.2-h078ce10_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-auth-0.7.16-h51b92d1_6.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-cal-0.6.10-hf888d4c_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-common-0.9.13-h93a5062_0.conda @@ -3566,6 +3583,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/dav1d-1.2.1-hb547adb_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/expat-2.6.2-hebf3989_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/fancycompleter-0.9.1-py311h267d04e_1007.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ffmpeg-6.1.1-gpl_h31ea89b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.4-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -3718,6 +3736,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/p11-kit-0.24.1-h29577a5_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pcre2-10.43-h26f9a81_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pillow-10.3.0-py311h0b5d0a1_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pixman-0.43.4-hebf3989_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.4.0-pyhd8ed1ab_0.conda @@ -3730,7 +3749,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pthread-stubs-0.4-h27ca646_1001.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pugixml-1.14-h13dd4ca_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/py-opencv-4.9.0-py311he78c7fc_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.17.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyrepl-0.9.0-py311h05b510d_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -3781,6 +3802,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.2.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x264-1!164.3095-h57fd34a_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x265-3.5-hbc6ce65_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/xdg-6.0.0-pyhd8ed1ab_0.conda @@ -3806,6 +3828,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.11-hd590300_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.8.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.1-h166bdaf_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-auth-0.7.16-h79b3bcb_6.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-cal-0.6.10-hb29e0c7_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-common-0.9.13-hd590300_0.conda @@ -3847,6 +3870,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.13.6-h5008d03_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/expat-2.6.2-h59595ed_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fancycompleter-0.9.1-py312h7900ff3_1007.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-6.1.1-gpl_h8007c5b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -4024,6 +4048,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/p11-kit-0.24.1-hc5aa10d_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.43-hcad00b1_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/pillow-10.3.0-py312hdcec9eb_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.43.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.4.0-pyhd8ed1ab_0.conda @@ -4038,9 +4063,11 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.14-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-hb77b528_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/py-opencv-4.9.0-py312h3b54b5c_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.17.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt-5.15.9-py312h949fe66_5.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyqt5-sip-12.12.2-py312h30efb56_5.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyrepl-0.9.0-py312h98912ed_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -4094,6 +4121,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.2.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/xcb-util-0.4.0-hd590300_1.conda @@ -4131,6 +4159,7 @@ environments: osx-arm64: - conda: https://conda.anaconda.org/conda-forge/noarch/absl-py-2.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aom-3.8.2-h078ce10_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-auth-0.7.16-h51b92d1_6.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-cal-0.6.10-hf888d4c_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/aws-c-common-0.9.13-h93a5062_0.conda @@ -4171,6 +4200,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/dav1d-1.2.1-hb547adb_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/expat-2.6.2-hebf3989_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/fancycompleter-0.9.1-py312h81bd7bf_1007.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ffmpeg-6.1.1-gpl_h31ea89b_104.conda - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 @@ -4313,6 +4343,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/p11-kit-0.24.1-h29577a5_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pcre2-10.43-h26f9a81_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pillow-10.3.0-py312h8a801b1_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pixman-0.43.4-hebf3989_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.4.0-pyhd8ed1ab_0.conda @@ -4325,7 +4356,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pthread-stubs-0.4-h27ca646_1001.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pugixml-1.14-h13dd4ca_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/py-opencv-4.9.0-py312h60e6991_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.17.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyrepl-0.9.0-py312he37b823_9.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha2e5f31_6.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-cov-5.0.0-pyhd8ed1ab_0.conda @@ -4376,6 +4409,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.2.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/versioningit-3.1.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/werkzeug-3.0.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x264-1!164.3095-h57fd34a_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/x265-3.5-hbc6ce65_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/xdg-6.0.0-pyhd8ed1ab_0.conda @@ -4535,6 +4569,23 @@ packages: license_family: GPL size: 71042 timestamp: 1660065501192 +- kind: conda + name: attrs + version: 23.2.0 + build: pyh71513ae_0 + subdir: noarch + noarch: python + url: https://conda.anaconda.org/conda-forge/noarch/attrs-23.2.0-pyh71513ae_0.conda + sha256: 77c7d03bdb243a048fff398cedc74327b7dc79169ebe3b4c8448b0331ea55fea + md5: 5e4c0743c70186509d1412e03c2d8dfa + depends: + - python >=3.7 + license: MIT + license_family: MIT + purls: + - pkg:pypi/attrs + size: 54582 + timestamp: 1704011393776 - kind: conda name: auto-intersphinx version: 1.0.3 @@ -6322,6 +6373,84 @@ packages: license_family: MIT size: 124594 timestamp: 1710362455984 +- kind: conda + name: fancycompleter + version: 0.9.1 + build: py311h267d04e_1007 + build_number: 1007 + subdir: osx-arm64 + url: https://conda.anaconda.org/conda-forge/osx-arm64/fancycompleter-0.9.1-py311h267d04e_1007.conda + sha256: 20048a12dfda40c554b5d4ef66bffdb7b7e33465075a96834bb94d75ed4fa2f1 + md5: f4ea4ddac68385fd5cc48c4be5cdceaa + depends: + - pyrepl >=0.8.2 + - python >=3.11,<3.12.0a0 + - python >=3.11,<3.12.0a0 *_cpython + - python_abi 3.11.* *_cp311 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fancycompleter + size: 27114 + timestamp: 1709161219225 +- kind: conda + name: fancycompleter + version: 0.9.1 + build: py311h38be061_1007 + build_number: 1007 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/fancycompleter-0.9.1-py311h38be061_1007.conda + sha256: 37d165c3d98306ef0459a4cd03947ab87b44ab8c18843014d7539562bc517abc + md5: f466c5e9657d0f95e75e3c5c66a75475 + depends: + - pyrepl >=0.8.2 + - python >=3.11,<3.12.0a0 + - python_abi 3.11.* *_cp311 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fancycompleter + size: 26644 + timestamp: 1709161005441 +- kind: conda + name: fancycompleter + version: 0.9.1 + build: py312h7900ff3_1007 + build_number: 1007 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/fancycompleter-0.9.1-py312h7900ff3_1007.conda + sha256: 12f78c53b9dac0ecfb1650a339bf8b950ba8f127a108eb09c3adda44a79ef31c + md5: 9dfab523f1136690d861fe337034dbee + depends: + - pyrepl >=0.8.2 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fancycompleter + size: 26174 + timestamp: 1709160998274 +- kind: conda + name: fancycompleter + version: 0.9.1 + build: py312h81bd7bf_1007 + build_number: 1007 + subdir: osx-arm64 + url: https://conda.anaconda.org/conda-forge/osx-arm64/fancycompleter-0.9.1-py312h81bd7bf_1007.conda + sha256: 895d2bdd1e56d28be8be0a46adbce92fcdf08e1b0dca073b99f2f4b5211603f9 + md5: 3b30d90c8ca61010a6f85eb9ce2a049f + depends: + - pyrepl >=0.8.2 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fancycompleter + size: 26498 + timestamp: 1709161451678 - kind: conda name: ffmpeg version: 6.1.1 @@ -12922,9 +13051,9 @@ packages: timestamp: 1704317789138 - kind: pypi name: mednet - version: 1.0.1.dev65+gc80a0d4.d20240420 + version: 1.0.1.dev71+ga0662a8.d20240421 path: . - sha256: 510e2fc8bc8804022768d52d426e3a77f85de6a94850c8f10ce4b615c22eaa01 + sha256: 83f9e120b24695e44eb704f01b05f4467c2c9dfc7ea01cfeaa747937e5551640 requires_dist: - clapper - click @@ -13804,6 +13933,26 @@ packages: license_family: BSD size: 950847 timestamp: 1708118050286 +- kind: conda + name: pdbpp + version: 0.10.3 + build: pyhd8ed1ab_0 + subdir: noarch + noarch: python + url: https://conda.anaconda.org/conda-forge/noarch/pdbpp-0.10.3-pyhd8ed1ab_0.tar.bz2 + sha256: c3f3996853853501af5ee936ebbd5a3de2eb1e73a078c7d4c541dbd97b315248 + md5: 3efee795aeb50ae2ca1ac732b529e603 + depends: + - fancycompleter + - pygments + - python >=3.4 + - wmctrl + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pdbpp + size: 25010 + timestamp: 1626016866544 - kind: conda name: pexpect version: 4.9.0 @@ -14699,6 +14848,86 @@ packages: - pkg:pypi/pyqt5-sip size: 85809 timestamp: 1695418132533 +- kind: conda + name: pyrepl + version: 0.9.0 + build: py311h05b510d_9 + build_number: 9 + subdir: osx-arm64 + url: https://conda.anaconda.org/conda-forge/osx-arm64/pyrepl-0.9.0-py311h05b510d_9.conda + sha256: 23246519bca1da29b85239f94dbbdb355af8232817a581fc3b78ef2ddda9c7ff + md5: 1afc76c94ad11f19b69378604f468acb + depends: + - ncurses + - python >=3.11,<3.12.0a0 + - python >=3.11,<3.12.0a0 *_cpython + - python_abi 3.11.* *_cp311 + license: ISC + license_family: OTHER + purls: + - pkg:pypi/pyrepl + size: 109869 + timestamp: 1709131378571 +- kind: conda + name: pyrepl + version: 0.9.0 + build: py311h459d7ec_9 + build_number: 9 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/pyrepl-0.9.0-py311h459d7ec_9.conda + sha256: 8077d98d1848a32069df26c725ae0d85ee9d76b621da06d156416403046d7036 + md5: b56fa4560cc2d6c047cc3d2398cd2926 + depends: + - libgcc-ng >=12 + - ncurses + - python >=3.11,<3.12.0a0 + - python_abi 3.11.* *_cp311 + license: ISC + license_family: OTHER + purls: + - pkg:pypi/pyrepl + size: 109486 + timestamp: 1709131157072 +- kind: conda + name: pyrepl + version: 0.9.0 + build: py312h98912ed_9 + build_number: 9 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/pyrepl-0.9.0-py312h98912ed_9.conda + sha256: 9e9d59e511c8a8e0792386bec59a87e584768f2856b1131191c6e98f50b03cc2 + md5: a56b87ccd13bc27b0e8ce66c75abe79e + depends: + - libgcc-ng >=12 + - ncurses + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: ISC + license_family: OTHER + purls: + - pkg:pypi/pyrepl + size: 104985 + timestamp: 1709131190353 +- kind: conda + name: pyrepl + version: 0.9.0 + build: py312he37b823_9 + build_number: 9 + subdir: osx-arm64 + url: https://conda.anaconda.org/conda-forge/osx-arm64/pyrepl-0.9.0-py312he37b823_9.conda + sha256: 41fd0010d8520d26a56e1585cc46b4bbcfbb94b9e3bcebcbe18885ea14a06fa6 + md5: 4c4540b6c01647e1737670f4f1142f7e + depends: + - ncurses + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: ISC + license_family: OTHER + purls: + - pkg:pypi/pyrepl + size: 105769 + timestamp: 1709131653373 - kind: conda name: pysocks version: 1.7.1 @@ -17812,6 +18041,24 @@ packages: - pkg:pypi/werkzeug size: 242286 timestamp: 1712099519271 +- kind: conda + name: wmctrl + version: '0.5' + build: pyhd8ed1ab_0 + subdir: noarch + noarch: python + url: https://conda.anaconda.org/conda-forge/noarch/wmctrl-0.5-pyhd8ed1ab_0.conda + sha256: b7526024b323b43ab8af687adeb6ee8f40aba70a9ee5939317d1b6b50e050061 + md5: eee592c2bd3901849b3732ff1da58049 + depends: + - attrs + - python >=3 + license: MIT + license_family: MIT + purls: + - pkg:pypi/wmctrl + size: 10415 + timestamp: 1695590958853 - kind: conda name: x264 version: 1!164.3095 diff --git a/pyproject.toml b/pyproject.toml index 6bf4dc99ab79a47408c9ebe3e53a7f6c52f42570..46026003dbf3ad681c26f7fad4a719a5a9f67543 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,6 +101,9 @@ versioningit = "*" [tool.pixi.feature.self.pypi-dependencies] mednet = { path = ".", editable = true } +[tool.pixi.feature.self.tasks] +info = "mednet info" + [tool.pixi.feature.py311.dependencies] python = "~=3.11.0" @@ -150,12 +153,15 @@ build = "hatch build" check = "twine check dist/*" upload = "twine upload dist/*" +[tool.pixi.feature.dev.dependencies] +pdbpp = "*" + [tool.pixi.environments] -default = { features = [ "qa", "doc", "test", "py312", "self" ], solve-group = "prod-group" } +default = { features = [ "qa", "doc", "test", "dev", "py312", "self" ], solve-group = "prod-group" } qa-only = { features = ["qa", "py312"], solve-group = "prod-group" } doc-only = { features = ["doc", "py312", "self"], solve-group = "prod-group" } -test-only-312 = { features = ["test", "py312", "self"], solve-group = "prod-group" } -test-only-311 = { features = ["test", "py311", "self"] } +test-only-312 = { features = ["test", "dev", "py312", "self"], solve-group = "prod-group" } +test-only-311 = { features = ["test", "dev", "py311", "self"] } build-only = { features = ["build", "py312"], solve-group = "prod-group" } prod = { features = ["py312", "self"], solve-group = "prod-group" } diff --git a/src/mednet/scripts/cli.py b/src/mednet/scripts/cli.py index fb3f605739811c9a5a5455cf6d8c8a89919c59f3..42f24b3f1cf087229aadff5c5858732308dd666b 100644 --- a/src/mednet/scripts/cli.py +++ b/src/mednet/scripts/cli.py @@ -17,6 +17,7 @@ def cli(): pass +cli.add_command(importlib.import_module("..info", package=__name__).info) cli.add_command(importlib.import_module("..config", package=__name__).config) cli.add_command( importlib.import_module("..database", package=__name__).database, diff --git a/src/mednet/scripts/info.py b/src/mednet/scripts/info.py new file mode 100644 index 0000000000000000000000000000000000000000..b8f3078e2b52503e17cb4851c41524ae6de0a924 --- /dev/null +++ b/src/mednet/scripts/info.py @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +import click +from clapper.click import verbosity_option +from clapper.logging import setup + +logger = setup(__name__.split(".")[0], format="%(levelname)s: %(message)s") + + +@click.command( + epilog="""Examples: + +1. Provide information about the current installation: + + .. code:: sh + + mednet info + +""", +) +@verbosity_option(logger=logger, expose_value=False) +def info( + **_, +) -> None: # numpydoc ignore=PR01 + """Provide information about the current installation.""" + + import typing + + from ..utils.rc import load_rc + from .database import _get_raw_databases + from .utils import execution_metadata + + def _echo(left: str, right: str, color: str = "white") -> None: + s = [ + click.style(left, bold=True), + click.style(": ", bold=True), + click.style(right, fg=color), + ] + click.echo("".join(s)) + + m = execution_metadata() + c = load_rc() + + _echo("mednet version", typing.cast(str, m["package-version"]), "green") + _echo("platform", typing.cast(str, m["platform"]), "yellow") + _echo( + "accelerators", + ", ".join(typing.cast(list[str], m["accelerators"])), + "cyan", + ) + + if not c.path.exists(): + _echo("configuration", f"{str(c.path)} [MISSING]", "white") + else: + _echo("configuration", str(c.path), "white") + dbs = _get_raw_databases() + click.secho("configured databases:", bold=True) + for k, v in dbs.items(): + if "datadir" not in v: + # this database does not have a "datadir" + continue + + if v["datadir"] is not None: + _echo(f" - {k} ({v['module']})", f"{v['datadir']}", "green") + else: + _echo(f" - {k} ({v['module']})", "NOT installed", "red") + + click.secho("dependencies:", bold=True) + python = typing.cast(dict[str, str], m["python"]) + _echo( + " - python", + f"{python['version']} ({python['path']})", + "white", + ) + deps = typing.cast(dict[str, str], m["dependencies"]) + for name, version in deps.items(): + _echo(f" - {name}", version, "white") diff --git a/src/mednet/scripts/utils.py b/src/mednet/scripts/utils.py index eaf78ee7aaa6226943ea277ddb881df843232f1b..9415838ac2663febe73ef871651f59ee3f508639 100644 --- a/src/mednet/scripts/utils.py +++ b/src/mednet/scripts/utils.py @@ -81,7 +81,9 @@ def device_properties( return retval -def execution_metadata() -> dict[str, int | float | str | dict[str, str]]: +def execution_metadata() -> ( + dict[str, int | float | str | dict[str, str] | list[str]] +): """Produce metadata concerning the running script, in the form of a dictionary. @@ -101,6 +103,7 @@ def execution_metadata() -> dict[str, int | float | str | dict[str, str]]: * ``command-line``: the command-line that is being run * ``hostname``: machine hostname (e.g. ``localhost``) * ``platform``: machine platform (e.g. ``darwin``) + * ``accelerator``: acceleration devices available (e.g. ``cuda``) """ import importlib.metadata @@ -118,7 +121,7 @@ def execution_metadata() -> dict[str, int | float | str | dict[str, str]]: # current date time, in ISO8610 format datetime = __import__("datetime").datetime.now().astimezone().isoformat() - # collects dependence information + # collects dependency information package_name = ( __package__.split(".")[0] if __package__ is not None else "unknown" ) @@ -150,10 +153,37 @@ def execution_metadata() -> dict[str, int | float | str | dict[str, str]]: logger.debug(f"Error {e}") pass + # checks if any acceleration device is present in the current platform + accelerators = [f"cpu ({torch.backends.cpu.get_cpu_capability()})"] + + if torch.cuda.is_available() and torch.backends.cuda.is_built(): + accelerators.append("cuda") + + if torch.backends.cudnn.is_available(): + accelerators.append("cudnn") + + if torch.backends.mps.is_available(): + accelerators.append("mps") + + if torch.backends.mkl.is_available(): + accelerators.append("mkl") + + if torch.backends.mkldnn.is_available(): + accelerators.append("mkldnn") + + if torch.backends.openmp.is_available(): + accelerators.append("openmp") + + python = { + "version": ".".join([str(k) for k in sys.version_info[:3]]), + "path": sys.executable, + } + return { "datetime": datetime, "package-name": package_name, "package-version": current_version, + "python": python, "dependencies": dependencies, "user": __import__("getpass").getuser(), "conda-env": os.environ.get("CONDA_DEFAULT_ENV", ""), @@ -161,6 +191,7 @@ def execution_metadata() -> dict[str, int | float | str | dict[str, str]]: "command-line": " ".join(args), "hostname": __import__("platform").node(), "platform": sys.platform, + "accelerators": accelerators, } diff --git a/tests/test_cli.py b/tests/test_cli.py index aa04ec07067766e5d7174db4cdd892783c7b5de6..d0c0c5d78581381c836b83ad265373490c195fe4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -40,6 +40,26 @@ def _check_help(entry_point): assert result.output.startswith("Usage:") +def test_info_help(): + from mednet.scripts.info import info + + _check_help(info) + + +def test_info(): + from mednet.scripts.info import info + + runner = CliRunner() + result = runner.invoke(info) + _assert_exit_0(result) + assert "platform:" in result.output + assert "accelerators:" in result.output + assert "version:" in result.output + assert "configured databases:" in result.output + assert "dependencies:" in result.output + assert "python:" in result.output + + def test_config_help(): from mednet.scripts.config import config