diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3e6a4f51..86a11e7e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,120 +8,8 @@ on: - "*" jobs: - setup_for_spack: - name: Run setup.py phases needed by spack - needs: [setup_test] - runs-on: ubuntu-latest - container: - image: precice/precice:develop - options: --user root - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Install & upgrade pip3 - run: | - apt-get -yy update - apt-get install -y python3-pip pkg-config - rm -rf /var/lib/apt/lists/* - pip3 install --upgrade --user pip - - name: Install dependencies - run: | - pip3 install --user toml - python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin - - name: Run setup.py phases needed by spack - run: | - python3 setup.py install_lib - python3 setup.py build_ext - - setup_install: - name: Run setup install - runs-on: ubuntu-latest - container: - image: precice/precice:develop - options: --user root - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Install pip3, pkgconfig and upgrade pip3 - run: | - apt-get -yy update - apt-get install -y python3-pip pkg-config - rm -rf /var/lib/apt/lists/* - pip3 install --upgrade --user pip - - name: Install dependencies - run: | - pip3 install --user toml - python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin - - name: Run setup install - run: python3 setup.py install --user - - name: Test install - run: | - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - python3 -c "import precice" - - setup_install_single_version_externally_managed: - name: Run setup install --single-version-externally-managed (for spack) - needs: [setup_install] - runs-on: ubuntu-latest - container: - image: precice/precice:develop - options: --user root - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Install pip3, pkgconfig and upgrade pip3 - run: | - su root - apt-get -yy update - apt-get install -y python3-pip pkg-config - rm -rf /var/lib/apt/lists/* - pip3 install --upgrade --user pip - - name: Install dependencies - run: | - pip3 install --user toml - python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin - - name: Run setup install --single-version-externally-managed - run: python3 setup.py install --single-version-externally-managed --root=/ - - setup_test: - name: Run setup test - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - - name: Install OpenMPI, CMake, Boost library, Eigen and pkg-config - run: | - sudo apt-get -yy update - sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev pkg-config - sudo rm -rf /var/lib/apt/lists/* - - uses: BSFishy/pip-action@v1 - with: - packages: toml - - name: Checkout precice and make required files discoverable - run: | - git clone --branch develop https://github.com/precice/precice.git precice-core - mkdir -p precice - cp precice-core/src/precice/Participant.hpp precice/Participant.hpp - cp precice-core/src/precice/Tooling.hpp precice/Tooling.hpp - cp precice-core/src/precice/Tooling.hpp precice/Tooling.cpp - cd precice-core - mkdir build && cd build - cmake .. -DPRECICE_FEATURE_MPI_COMMUNICATION=OFF -DPRECICE_FEATURE_PETSC_MAPPING=OFF -DPRECICE_FEATURE_PYTHON_ACTIONS=OFF -DBUILD_TESTING=OFF - - name: Install dependencies - run: | - python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin - - name: Run setup test - env: - PKG_CONFIG_PATH: "precice-core/build" - PKG_CONFIG_SYSTEM_INCLUDE_PATH: 1 - run: | - export CFLAGS=-I$GITHUB_WORKSPACE - python3 setup.py test - pip_install: name: Run pip install - needs: [setup_test] runs-on: ubuntu-latest container: image: precice/precice:develop @@ -144,7 +32,7 @@ jobs: solverdummy_test: name: Run solverdummy - needs: [setup_install, setup_test] + needs: [pip_install] runs-on: ubuntu-latest container: image: precice/precice:develop diff --git a/.github/workflows/build-env.yml b/.github/workflows/build-env.yml deleted file mode 100644 index cf44d754..00000000 --- a/.github/workflows/build-env.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Update build environment - -on: - workflow_dispatch: # Trigger by hand from the UI - schedule: - - cron: '0 0 * * 0' # Schedule it every Sunday - -jobs: - build-spack-pyprecice-deps: - name: Builds the baseimage for spack providing dependencies - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Set up Docker - uses: docker/setup-buildx-action@v1 - - name: Login to registry - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - push: true - context: . - file: spack/ci-spack-pyprecice-deps-2404.dockerfile - tags: precice/ci-spack-pyprecice-deps-2404 diff --git a/.github/workflows/build-spack.yml b/.github/workflows/build-spack.yml deleted file mode 100644 index 8ff0b6cb..00000000 --- a/.github/workflows/build-spack.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build Spack -on: - push: - branches: - - "*" - pull_request: - branches: - - "*" - schedule: - - cron: '0 4 * * 1' # Schedule it every Sunday - -jobs: - build_spack: - name: build_spack - runs-on: ubuntu-latest - timeout-minutes: 15 - container: precice/ci-spack-pyprecice-deps-2404 - defaults: - run: - shell: "bash --login -eo pipefail {0}" - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Move Package Script - run: | - cp -r spack/repo/packages/py-pyprecice/ /py-pyprecice-repo/packages/ - - name: Try to build py-pyprecice@develop with spack and test it - run: | - . /opt/spack/share/spack/setup-env.sh - spack env activate ci && spack arch - spack remove py-pyprecice - spack add pyprecice.test.py-pyprecice@develop && spack develop pyprecice.test.py-pyprecice@develop - spack install && spack find - spack load py-pyprecice - BINDINGS_VERSION=$(python3 -c "import precice; print(precice.__version__)") && echo "Installed version of bindings is ${BINDINGS_VERSION}" \ No newline at end of file diff --git a/README.md b/README.md index 92898c61..982e7852 100644 --- a/README.md +++ b/README.md @@ -59,66 +59,12 @@ If preCICE (the C++ library) was installed in a custom prefix, or only built but * `LIBRARY_PATH`, `LD_LIBRARY_PATH` to the library location, or `$prefix/lib` * `CPATH` either to the `src` directory or the `$prefix/include` -The preCICE documentation provides more informaiton on [linking preCICE](https://precice.org/installation-linking.html). +The preCICE documentation provides more information on [linking preCICE](https://precice.org/installation-linking.html). ### Using Spack You can also install the python language bindings for preCICE via Spack by installing the Spack package `py-pyprecice`. Refer to [our installation guide for preCICE via Spack](https://precice.org/installation-spack.html) for getting started with Spack. -### Using setup.py - -#### preCICE system installs - -In this directory, execute: - -```bash -$ python3 setup.py install --user -``` - -#### preCICE at custom location (setting PATHS) - -see above. Then run - -```bash -$ python3 setup.py install --user -``` - -#### preCICE at custom location (explicit include path, library path) - -1. Install cython and other dependencies via pip3 - - ```bash - $ pip3 install --user setuptools wheel cython packaging numpy - ``` - -2. Open terminal in this folder. -3. Build the bindings - - ```bash - $ python3 setup.py build_ext --include-dirs=$PRECICE_ROOT/src --library-dirs=$PRECICE_ROOT/build/last - ``` - - **Options:** - * `--include-dirs=`, default: `''` - Path to the headers of preCICE, point to the sources `$PRECICE_ROOT/src`, or the your custom install prefix `$prefix/include`. - - **NOTES:** - - * If you have built preCICE using CMake, you can pass the path to the CMake binary directory using `--library-dirs`. - * It is recommended to use preCICE as a shared library here. - -4. Install the bindings - - ```bash - $ python3 setup.py install --user - ``` - -5. Clean-up *optional* - - ```bash - $ python3 setup.py clean --all - ``` - ## Test the installation Update `LD_LIBRARY_PATH` such that python can find `precice.so` diff --git a/spack/README.md b/spack/README.md deleted file mode 100644 index a8f92f4c..00000000 --- a/spack/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Spack package: py-pyprecice - -The Spack package `py-pyprecice` provides the python bindings via Spack and was submitted via [pull request 19558](https://github.com/spack/spack/pull/19558) in the Spack repository. This folder contains the Spack package script that can be used for testing whether the Spack installation works. - -## Docker image `precice/ci-spack-pyprecice-deps-2404` - -The workflow `build-spack-pyprecice-deps` in `.github/workflows/build-env.yml` creates the image `precice/ci-spack-pyprecice-deps-2404`. This image contains all dependencies of `py-pyprecice@develop`. - -The workflow `build_spack` in `.github/workflows/build-spack.yml` uses the image `precice/ci-spack-pyprecice-deps-2404` to reduce build time. The workflow uses the `package.py` from this repository to build the latest version of the bindings and run a small test on this version. - -## When a new Spack release is necessary - -* Add checksum of newest version(s) to the [package recipe in `package.py`](https://github.com/precice/python-bindings/blob/develop/spack/repo/packages/py-pyprecice/package.py). You can get checksum for any released version by running `spack checksum py-pyprecice`. -* Check whether the new release works locally. You can add the Spack repo in this repository and do the following: - - 1. Add the repository to your Spack installation if you have not done that before. You can check the repositories available with your Spack installation via `spack repo list`. If there is a repository called `pyprecice.test`, check whether it points to the correct path. The correct path is the `spack/repo` directory of python-bindings repository. If the repository is missing, add it via - - ```text - spack repo add ${REPOSITORY_ROOT}/spack/repo - ``` - - 2. Build the new python bindings. Usually, we use a new Spack environment. This is created and loaded via - - ```text - spack env create pyprecicetest-VERSIONNUMBER - spack env activate -p pyprecicetest-VERSIONNUMBER - ``` - - Note that the dots `.` of the version number are not allowed in the name of Spack environments. One could, e.g., create an environment named `pyprecicetest-2_0_0_1` instead of `pyprecicetest-2.0.0.1`. - - 3. We add the `py-pyprecice` package from our repository to the environment via - - ```text - spack add pyprecice.test.py-pyprecice@VERSIONNUMBER - ``` - - This ensures that one uses the local repository which has the namespace `pyprecice.test` when installing `py-precice`. Note that when speciying the `VERSIONNUMBER` you use the actual version number with dots, e.g., `2.0.0.1`, but you have to drop the `v` character from the versioning of the bindings. - - 4. Concretize the software packages - - ```text - spack concretize -f - ``` - - and check whether everything looks good. You might want to edit the environment of the Spack environment (the `spack.yaml` file) and enforce combined concretization by adding `concretization: together` at the end of the file. You might want to double check whether the correct repository is used by calling - - ```text - spack spec -N py-pyprecice@VERSIONNUMBER - ``` - - It will print the concretization and prefixes each packages with the repository it will be installed from. - - 5. Run `spack install` to actually install the package. - - 6. If the installation went through, check the installation by running `python3 -c "import precice; print(precice.__version__)"`. This should print the version number of the Python bindings you have installed. *Note*: In order to make the bindings available one might have to reload the environment via - - ```text - despacktivate - spack env activate -p pyprecicetest-VERSIONNUMBER - ``` - - 7. Ideally one runs the solverdummy with the freshly installed Python bindings. - -* Use `package.py` together with the patches provided in `python-bindings/spack/repo/packages/py-pyprecice` to [create a pull request for Spack](https://github.com/spack/spack/compare) and submit the new release. -* After the pull request in the Spack repository is merged, merge the current package configuration into the repository of the Python bindings if necessery. diff --git a/spack/ci-spack-pyprecice-deps-2404.dockerfile b/spack/ci-spack-pyprecice-deps-2404.dockerfile deleted file mode 100644 index 13051242..00000000 --- a/spack/ci-spack-pyprecice-deps-2404.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Build stage with Spack pre-installed and ready to be used -FROM spack/ubuntu-noble:latest - -# Mount the current sources into the build container -# and build the default environment -ADD ./spack/repo /py-pyprecice-repo -RUN spack --color=always env create --without-view ci && \ - spack --color=always -e ci repo add /py-pyprecice-repo && \ - spack --color=always -e ci add pyprecice.test.py-pyprecice@develop target=x86_64 && \ - spack --color=always -e ci install --fail-fast --only=dependencies && \ - spack --color=always clean -a diff --git a/spack/repo/packages/py-pyprecice/package.py b/spack/repo/packages/py-pyprecice/package.py deleted file mode 100644 index 7ee79d6e..00000000 --- a/spack/repo/packages/py-pyprecice/package.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack.package import * - - -class PyPyprecice(PythonPackage): - """ - This package provides python language bindings for the - C++ library preCICE. - """ - - homepage = "https://precice.org" - git = "https://github.com/precice/python-bindings.git" - url = "https://github.com/precice/python-bindings/archive/v3.1.1.tar.gz" - maintainers("ajaust", "BenjaminRodenberg", "IshaanDesai") - - # Always prefer final version of release candidate - version("develop", branch="develop") - version("3.1.1", sha256="50a0f1cbdb8fc362c22d316151c0e757958ff136a094e63b9b82d045d01d19c7") - version("3.1.0", sha256="8d9bd9e28859001ab503a1e2f90e54b3c000079f04c14dc7c0c04c61c5666641") - version("3.0.0.0", sha256="7e2c4b106a231b0df2a430d86d4a7b295f85adbe3478c425f863d1a4bebee9f7") - version("2.5.0.4", sha256="7f9449573eb52ce48ca3f0ab35529ea0064942487842515ae0a2c9299aa0f0db") - version("2.5.0.3", sha256="b983229b9fdf6bd4605ae8710985eb681025f6fb28ad8d7736cdf92593eef6df") - version("2.5.0.2", sha256="6d7b78da830db6c5133b44617196ee90be8c7d6c8e14c8994a4800b3d4856416") - version("2.5.0.1", sha256="d7c666e6ebff9e007c3703d8e3c3fcdf0f45289e36c2c17223b3aedc3259ab6c") - version("2.5.0.0", sha256="9f55a22594bb602cde8a5987217728569f16d9576ea53ed00497e9046a2e1794") - version("2.4.0.0", sha256="e80d16417b8ce1fdac80c988cb18ae1e16f785c5eb1035934d8b37ac18945242") - version("2.3.0.1", sha256="ed4e48729b662680beaa4ee2a9aff724a79e760534c6c58181be739988da2789") - version("2.2.1.1", sha256="139bac5077c3807e1b7b83d8d0da5ca0fc8c17393fd0df4bc5999cd63a351b78") - version("2.2.0.2", sha256="2287185f9ad7500dced53459543d27bb66bd2438c2e4bf81ee3317e6a00513d5") - version("2.2.0.1", sha256="229625e2e6df03987ababce5abe2021b0974cbe5a588b936a9cba653f4908d4b") - version("2.1.1.2", sha256="363eb3eeccf964fd5ee87012c1032353dd1518662868f2b51f04a6d8a7154045") - version("2.1.1.1", sha256="972f574549344b6155a8dd415b6d82512e00fa154ca25ae7e36b68d4d2ed2cf4") - version("2.1.0.1", sha256="ac5cb7412c6b96b08a04fa86ea38e52d91ea739a3bd1c209baa93a8275e4e01a") - version("2.0.2.1", sha256="c6fca26332316de041f559aecbf23122a85d6348baa5d3252be4ddcd5e94c09a") - version("2.0.1.1", sha256="2791e7c7e2b04bc918f09f3dfca2d3371e6f8cbb7e57c82bd674703f4fa00be7") - version("2.0.0.2", sha256="5f055d809d65ec2e81f4d001812a250f50418de59990b47d6bcb12b88da5f5d7") - version("2.0.0.1", sha256="96eafdf421ec61ad6fcf0ab1d3cf210831a815272984c470b2aea57d4d0c9e0e") - - for ver in [ - "develop", - "3.1", # only consider major.minor from 3.1.0. See https://github.com/precice/python-bindings/pull/199 - "3.0.0", - "2.5.0", - "2.4.0", - "2.3.0", - "2.2.1", - "2.2.0", - "2.1.1", - "2.1.0", - "2.0.2", - "2.0.1", - "2.0.0", - ]: - depends_on("precice@" + ver, when="@" + ver) - - depends_on("python@3:", type=("build", "link", "run")) - depends_on("py-setuptools@61:71", type="build") - depends_on("py-numpy@:1", type=("build", "link", "run")) - depends_on("py-mpi4py", type=("build", "run")) - depends_on("py-cython@0.29:", type="build") - depends_on("py-packaging", type="build") - depends_on("py-pip@19.0.0:", type="build") - depends_on("py-pkgconfig", type="build", when="@2.5:") - - @when("@:2.1") - def patch(self): - filter_file("distutils.command.install", "setuptools.command.install", "setup.py") diff --git a/spack/repo/repo.yaml b/spack/repo/repo.yaml deleted file mode 100644 index e484875a..00000000 --- a/spack/repo/repo.yaml +++ /dev/null @@ -1,2 +0,0 @@ -repo: - namespace: 'pyprecice.test'