Pre-install Python dependencies in CI Docker images.
authorM. Eric Irrgang <mei2n@virginia.edu>
Tue, 19 Oct 2021 15:25:43 +0000 (15:25 +0000)
committerAndrey Alekseenko <al42and@gmail.com>
Tue, 19 Oct 2021 15:25:43 +0000 (15:25 +0000)
Add `pybind11` and `wheel` to the (scripted) Docker image builds so that
the admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh script can use
`--no-deps --no-index` with pip.

Remove `pip install pybind11` where it is no longer needed in CI jobs.

Follow-up to #4092.

admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh
admin/containers/scripted_gmx_docker_builds.py
admin/gitlab-ci/documentation.gitlab-ci.yml
admin/gitlab-ci/lint.gitlab-ci.yml
python_packaging/src/setup.py

index b05a625d3ae287d6fb3397a8e53b4f5d626c4611..43cc75f0e0cf5afc353c61238651f9e9cc54f13d 100644 (file)
@@ -21,18 +21,14 @@ pushd python_packaging/src
   # Make sure to delete any accidentally lingering build artifacts.
   rm -rf build dist
   # Build and install the gmxapi Python package.
-# TODO(#4092): Revert to using --no-deps and --no-index once Docker images updated.
+  # TODO(#3273): Reduce requirements for `setup.py` `sdist` command and provide build artifact.
   GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
       python -m pip install \
+          --no-build-isolation \
           --no-cache-dir \
+          --no-deps \
+          --no-index \
           .
-#  # TODO(#3273): Reduce requirements for `setup.py` `sdist` command and provide build artifact.
-#  GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
-#      python -m pip install \
-#          --no-cache-dir \
-#          --no-deps \
-#          --no-index \
-#          .
 popd
 
 # Run Python unit tests.
index 4492c4593665ff002c0016b29f737fa36f75f17f..59971bce5808f8378d706c33bb3ccee3453993bf 100755 (executable)
@@ -517,17 +517,14 @@ def prepare_venv(version: StrictVersion) -> typing.Sequence[str]:
             'networkx>=2.0' \
             'numpy>=1' \
             'pip>=10.1' \
+            'pybind11>2.6' \
             'Pygments>=2.2.0' \
             'pytest>=3.9' \
             'setuptools>=42' \
+            'scikit-build>=0.10' \
             'Sphinx>=1.6.3' \
-            'sphinxcontrib-plantuml>=0.14'""")
-
-    # TODO: Remove 'importlib_resources' dependency when Python >=3.7 is required.
-    if minor == 6:
-        commands.append(f"""{venv_path}/bin/python -m pip install --upgrade \
-                'importlib_resources'""")
-
+            'sphinxcontrib-plantuml>=0.14' \
+            'wheel'""")
     return commands
 
 
index cb717d2c0d97b5331a3d4eb6a3e8ff4ec28f6b91..e0df386b4a640b7050e8df7a502f262c30904a8c 100644 (file)
@@ -47,8 +47,6 @@
     # without additional hinting. Once CMakeCache.txt exists, the later stages
     # should work fine without reactivating the venv.
     - source /root/venv/py3.7/bin/activate
-    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
-    - /root/venv/py3.7/bin/pip install pybind11
     - cmake ..
       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
       $CMAKE_COMPILER_SCRIPT
       fi
     - cd $RELEASE_BUILD_DIR
     - source /root/venv/py3.7/bin/activate
-    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
-    - /root/venv/py3.7/bin/pip install pybind11
     - cmake ../$RELEASE_SOURCE/
       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
       $CMAKE_COMPILER_SCRIPT
@@ -195,8 +191,6 @@ docs:configure:
   image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-7-docs
   script:
     - cd $BUILD_DIR
-    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
-    - /root/venv/py3.7/bin/pip install pybind11
     - cmake --build . --target gmx -- -j8
     - cd ..
   artifacts:
@@ -244,8 +238,6 @@ docs:build:
     - cd $BUILD_DIR
     - cmake --build . --target manual -- -j4 | tee docs/manual/all-output.log
       | grep -i "warning" | grep -v "TeX" | grep -v "Package" || true
-    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
-    - /root/venv/py3.7/bin/pip install pybind11
     - cmake --build . --target webpage -- -j4
     - grep "WARNING:" docs/manual/all-output.log | tee pythonErrors.log || true
     - grep -i "error" docs/sphinx-*.log | tee sphinxDiagnostics.log || true
index 4c7a414cdf1a6ace496e43ece34990b113ebe43e..d5b43ad9b9ac869a43c36a84999e45b3bcae1272 100644 (file)
@@ -185,8 +185,6 @@ check-source:
   script:
     - CMAKE=${CMAKE:-$(which cmake)}
     - cd $BUILD_DIR
-    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
-    - /root/venv/py3.7/bin/pip install pybind11
     - $CMAKE --build . --target check-source
     - awk '/warning.*include style.*order/,/You can use.*rst|^$/' docs/doxygen/check-source.log | tee doxygenError.txt || true
     - awk '/warning:.*includes/,/unnecessarily|^$/' docs/doxygen/check-source.log | tee -a doxygenError.txt || true
index 742509b666cc8757f5386ebd7df4a70f1a825388..55ee2f4f5e79f4ba91726bf1ae8866eb86306107 100644 (file)
@@ -242,9 +242,13 @@ def update_gromacs_client_cmake_args(args: typing.List[str]):
                 if suffix is not None:
                     gmx_toolchain_dir = os.path.join(share_cmake, 'gromacs' + suffix)
 
-    if gmx_toolchain_dir is None:
+    if gmx_toolchain_dir is None or not os.path.exists(gmx_toolchain_dir):
         print(usage)
-        raise GmxapiInstallError('Could not configure for GROMACS installation. Provide GMXTOOLCHAINDIR.')
+        raise GmxapiInstallError(
+            'Could not configure for GROMACS installation. '
+            'Provide GMXTOOLCHAINDIR or CMAKE_TOOLCHAIN_FILE. '
+            'See https://manual.gromacs.org/current/gmxapi/userguide/install.html'
+        )
 
     suffix = os.path.basename(gmx_toolchain_dir).strip('gromacs')
     gmx_toolchain = os.path.abspath(os.path.join(gmx_toolchain_dir, 'gromacs-toolchain' + suffix + '.cmake'))