From 88abae089c5603f29593ba138d8a84030d44b969 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 24 Apr 2024 11:56:12 +0100 Subject: [PATCH 01/11] Remove support for Python 3.8, enforce Python3.10+ --- CMakeLists.txt | 6 +++--- process/impurity_radiation.py | 7 +------ process/io/plot_proc.py | 7 +------ requirements.txt | 1 - setup.py | 2 +- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db15c7829e..780f82bd77 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMake file for Pythonic PROCESS # Author : PROCESS Team (UKAEA) -# Date : last modified 2023-07-24 +# Date : last modified 2024-04-24 # Specify the minimum version for CMake # 3.12 is required due to use of list TRANSFORM commands @@ -18,8 +18,8 @@ if(CMAKE_HOST_APPLE) set(CMAKE_MACOSX_RPATH ON) endif() -# Python 3.8 or greater -find_package(Python3 3.8 COMPONENTS Interpreter Development) +# Python 3.10 or greater +find_package(Python3 3.10 COMPONENTS Interpreter Development) # Read in external CMake scripts for preprocessing, f2py, ford, etc. INCLUDE(${CMAKE_SOURCE_DIR}/cmake/pip.cmake) diff --git a/process/impurity_radiation.py b/process/impurity_radiation.py index 0c513a1e04..a0997370e4 100644 --- a/process/impurity_radiation.py +++ b/process/impurity_radiation.py @@ -1,18 +1,13 @@ import numpy import dataclasses import re -import sys +from importlib import resources from typing import Optional, List from pathlib import Path from scipy import integrate from process.fortran import impurity_radiation_module from process.fortran import error_handling -if sys.version_info >= (3, 9): - from importlib import resources -else: - import importlib_resources as resources - import logging diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 2a154b89ea..c3394b2868 100755 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -15,11 +15,11 @@ """ import os -import sys import argparse from argparse import RawTextHelpFormatter import matplotlib import matplotlib.pyplot as plt +from importlib import resources from matplotlib.patches import Rectangle from matplotlib.patches import Circle import matplotlib.backends.backend_pdf as bpdf @@ -59,11 +59,6 @@ matplotlib.use("Agg") matplotlib.rcParams["figure.max_open_warning"] = 40 -if sys.version_info >= (3, 7): - from importlib import resources -else: - import importlib_resources as resources - def parse_args(args): """Parse supplied arguments. diff --git a/requirements.txt b/requirements.txt index 76aa750397..2a4434de95 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -importlib-resources==5.0.0 ; python_version < '3.9' mkdocs>=1.1 mkdocs-material>=4.6.3 mkdocs-git-revision-date-localized-plugin >= 1.2 diff --git a/setup.py b/setup.py index 875a443a9f..f00fec0e65 100644 --- a/setup.py +++ b/setup.py @@ -34,11 +34,11 @@ "process.uncertainties": ["*.json"], }, "test_suite": "pytest", + "python_requires": ">=3.10", "install_requires": [ "numpy>=1.23", "scipy>=1.10", "cvxpy!=1.3.0,!=1.3.1", - "importlib-resources ; python_version<'3.9'", "pandas", "tables", "SALib", From a7e2ebb5a557dcbc40ce965b687047f11f92805b Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 24 Apr 2024 13:31:28 +0100 Subject: [PATCH 02/11] Update CI to use Python3.10 --- .github/workflows/process.yml | 18 +++++++++--------- docker/ci/Dockerfile | 8 +++----- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index 9975f7cdcf..709b8ac2d3 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -40,7 +40,7 @@ jobs: docker build . -t ghcr.io/ukaea/process-ci:latest docker push ghcr.io/ukaea/process-ci:latest - make-py38: + make: runs-on: ubuntu-latest needs: docker container: @@ -75,9 +75,9 @@ jobs: name: ford-artifact path: build/ford_project.pickle - unit-py38: + unit: runs-on: ubuntu-latest - needs: make-py38 + needs: make container: image: ghcr.io/ukaea/process-ci:latest credentials: @@ -101,9 +101,9 @@ jobs: name: unit-coverage-artifacts path: .coverage - integration-py38: + integration: runs-on: ubuntu-latest - needs: make-py38 + needs: make container: image: ghcr.io/ukaea/process-ci:latest credentials: @@ -122,12 +122,12 @@ jobs: run: pytest tests/integration -n auto -v - regression-py38: + regression: runs-on: ubuntu-latest - needs: [make-py38, tracking] + needs: [make, tracking] # depend on make and tracking job, check make job was successful # but dont skip if tracking was skipped - if: always() && needs.make-py38.result == 'success' + if: always() && needs.make.result == 'success' continue-on-error: true container: image: ghcr.io/ukaea/process-ci:latest @@ -155,7 +155,7 @@ jobs: run-tracking-inputs: runs-on: ubuntu-latest - needs: make-py38 + needs: make container: image: ghcr.io/ukaea/process-ci:latest credentials: diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile index f0a845b8be..14979c7164 100644 --- a/docker/ci/Dockerfile +++ b/docker/ci/Dockerfile @@ -58,12 +58,10 @@ RUN apt-get install -y \ # Install pyenv. RUN curl https://pyenv.run | bash ENV PYENV_ROOT /root/.pyenv -ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/versions/3.8.12/bin:$PATH +ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/versions/3.10.14/bin:$PATH - -# Install python version 3.8.12 and set as global. -RUN pyenv install 3.8.12 && \ - pyenv global 3.8.12 +RUN pyenv install 3.10.14 && \ + pyenv global 3.10.14 RUN python -m pip install --upgrade pip && \ From 2a9d27aacaba9f140b309745f033e516a6089d0f Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 24 Apr 2024 13:42:42 +0100 Subject: [PATCH 03/11] Remove need to build Docker container --- .github/workflows/process.yml | 86 ++++++++++++----------------------- 1 file changed, 28 insertions(+), 58 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index 709b8ac2d3..6d6bcce114 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -11,45 +11,13 @@ permissions: id-token: write jobs: - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check for changed files affecting the container - uses: dorny/paths-filter@v2 - id: changes - with: - filters: | - build_container: - - 'docker/ci/Dockerfile' - - 'requirements.txt' - - 'requirements_dev.txt' - - name: Login to GitHub Container Registry - if: steps.changes.outputs.build_container == 'true' && github.ref == 'refs/heads/main' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: timothy-nunn - password: ${{ secrets.PROCESS_CI_PAT }} - - name: Build the PROCESS Docker image - if: steps.changes.outputs.build_container == 'true' && github.ref == 'refs/heads/main' - run: | - cp requirements.txt docker/ci/ - cp requirements_dev.txt docker/ci/ - cd docker/ci - docker build . -t ghcr.io/ukaea/process-ci:latest - docker push ghcr.io/ukaea/process-ci:latest - make: runs-on: ubuntu-latest - needs: docker - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Build PROCESS run: | git config --global --add safe.directory '*' @@ -78,13 +46,11 @@ jobs: unit: runs-on: ubuntu-latest needs: make - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Download build artifacts uses: actions/download-artifact@v3 with: @@ -92,7 +58,9 @@ jobs: path: process/ - name: Install PROCESS # Editable install to match default install - run: pip install -e . + run: | + pip install -e . + pip install -r requirements_dev.txt - name: Run unit tests run: pytest --cov=process tests/unit -v - name: Archive unit test coverage data @@ -104,20 +72,21 @@ jobs: integration: runs-on: ubuntu-latest needs: make - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Download build artifacts uses: actions/download-artifact@v3 with: name: process-build-artifacts path: process/ - name: Install PROCESS - run: pip install -e . + # Editable install to match default install + run: | + pip install -e . + pip install -r requirements_dev.txt - name: Run integration tests run: pytest tests/integration -n auto -v @@ -129,11 +98,6 @@ jobs: # but dont skip if tracking was skipped if: always() && needs.make.result == 'success' continue-on-error: true - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: tolerance: [0, 5] @@ -141,15 +105,21 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Download build artifacts uses: actions/download-artifact@v3 with: name: process-build-artifacts path: process/ - name: Install PROCESS - run: pip install -e . + # Editable install to match default install + run: | + pip install -e . + pip install -r requirements_dev.txt - name: Allow git commands to be run - run: git config --system --add safe.directory '*' + run: sudo git config --system --add safe.directory '*' - name: Run regression tests run: pytest tests/regression -sv --reg-tolerance=${{ matrix.tolerance }} @@ -249,7 +219,7 @@ jobs: shell: bash run: | MSG=$(printf "%q" $COMMIT_MESSAGE) - git config --global --add safe.directory '*' + sudo git config --global --add safe.directory '*' python tracking/tracking_data.py track process-tracking-data --mfile tracking/large_tokamak_MFILE.DAT --hash ${{ github.sha }} --commit '${MSG}' cp tracking/large_tokamak_MFILE.DAT process-tracking-data/large_tokamak_MFILE_$(git rev-parse HEAD).DAT python tracking/tracking_data.py track process-tracking-data --mfile tracking/st_regression_MFILE.DAT --hash ${{ github.sha }} --commit '${MSG}' @@ -267,8 +237,8 @@ jobs: path: tracking.html - name: Setup Git identity run: | - git config --global user.email "${{ github.triggering_actor }}@github.runner" - git config --global user.name "${{ github.job }}" + sudo git config --global user.email "${{ github.triggering_actor }}@github.runner" + sudo git config --global user.name "${{ github.job }}" - name: Commit and push tracking data run: | cd process-tracking-data @@ -307,7 +277,7 @@ jobs: path: build/ - run: python scripts/document_fortran_interface.py - run: python scripts/vardes.py - - run: git config --global --add safe.directory '*' + - run: sudo git config --global --add safe.directory '*' - run: mkdocs build - run: mv ford_site site - name: Download tracking html From fed648708a575a55c90563897d7c71de31916d75 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 13:59:44 +0100 Subject: [PATCH 04/11] Update dependency management --- CMakeLists.txt | 12 +++++++++--- cmake/ford.cmake | 3 +++ cmake/pip.cmake | 28 ++++++++-------------------- requirements.txt | 28 ++++++---------------------- requirements_dev.txt | 13 ++++++++----- setup.py | 16 ++++++---------- 6 files changed, 40 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 780f82bd77..908764827a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,9 +176,15 @@ ADD_CUSTOM_TARGET(coverage_cleanup ) # Run the Pip Install -ADD_CUSTOM_TARGET(install_process ALL - COMMAND ${Python3_EXECUTABLE} -m pip install --no-cache-dir -e ${CMAKE_SOURCE_DIR} -) +if(${RELEASE}) + ADD_CUSTOM_TARGET(install_process ALL + COMMAND ${Python3_EXECUTABLE} -m pip install --no-cache-dir -e ${CMAKE_SOURCE_DIR} + ) +else() + ADD_CUSTOM_TARGET(install_process ALL + COMMAND ${Python3_EXECUTABLE} -m pip install --no-cache-dir -e '${CMAKE_SOURCE_DIR}[test,examples]' + ) +endif() ADD_DEPENDENCIES(install_process ${PIP_NAME} f2py ${FORD_NAME} ${GFORTLIB_NAME} ${DICTS_NAME} coverage_cleanup) diff --git a/cmake/ford.cmake b/cmake/ford.cmake index 9ecb36574f..349e158a40 100644 --- a/cmake/ford.cmake +++ b/cmake/ford.cmake @@ -34,6 +34,9 @@ MACRO(DICTS) ADD_CUSTOM_COMMAND(OUTPUT ${DICTS_OUTPUT_FILE} ${DICTS_PYTHON_OUT} + # The dicts import process, install it (it will be installed again later) + COMMAND ${Python3_EXECUTABLE} -m pip install ${CMAKE_SOURCE_DIR} + # The create_dicts script needs to know the Fortran source dir, the pickled # Ford project object and the dicts.json file to output to COMMAND ${Python3_EXECUTABLE} ${CREATE_DICTS_SCRIPT} ${PROCESS_SRC_DIR} ${FORD_OUTPUT} diff --git a/cmake/pip.cmake b/cmake/pip.cmake index 4ee35aa1cc..bde19e84c3 100644 --- a/cmake/pip.cmake +++ b/cmake/pip.cmake @@ -7,12 +7,13 @@ MACRO(PIP_INSTALL) SET(PIP_NAME "pip_installs") - if ( RELEASE ) + + if(RELEASE) SET(RELEASE TRUE) else() SET(RELEASE FALSE) endif() - + EXECUTE_PROCESS( COMMAND bash -c "${Python3_EXECUTABLE} -c \"import ford\"" OUTPUT_VARIABLE FORD_CHECK @@ -48,24 +49,11 @@ MACRO(PIP_INSTALL) DEPENDS ${PIP_COMPLETE_FILE} ) - # Manually install numpy as including it in requirements doesnt install it - # It is a pre-requisite to f90wrap install - if (${RELEASE}) - ADD_CUSTOM_COMMAND( - OUTPUT ${PIP_COMPLETE_FILE} - COMMAND ${Python3_EXECUTABLE} -m pip install numpy - COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} - COMMAND touch ${PIP_COMPLETE_FILE} - ) - else() - ADD_CUSTOM_COMMAND( - OUTPUT ${PIP_COMPLETE_FILE} - COMMAND ${Python3_EXECUTABLE} -m pip install numpy - COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} - COMMAND ${Python3_EXECUTABLE} -m pip install -r ${DEVELOP_REQUIREMENTS_FILE} - COMMAND touch ${PIP_COMPLETE_FILE} - ) - endif() + ADD_CUSTOM_COMMAND( + OUTPUT ${PIP_COMPLETE_FILE} + COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} + COMMAND touch ${PIP_COMPLETE_FILE} + ) ADD_DEPENDENCIES(${PIP_NAME} ford_git) ENDMACRO() diff --git a/requirements.txt b/requirements.txt index 2a4434de95..7c018584a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,24 +1,8 @@ -mkdocs>=1.1 -mkdocs-material>=4.6.3 -mkdocs-git-revision-date-localized-plugin >= 1.2 -mkdocs-glightbox >= 0.3.4 -pymdown-extensions>=6.3 +# numpy is required for some of the install scripts numpy>=1.23 -scipy>=1.10 -matplotlib>=2.1.1 -pillow>=5.1.0 + +# Markdown versions for ford compatibility Markdown>=3.2.2,<3.4 -toposort>=1.5 -netCDF4>=1.5.4 -wheel>=0.36.2 -jupyter==1.0.0 -pdf2image==1.16.0 -numba>=0.57 -pandas>=1.1.5 -bokeh==2.4.0 -mkdocstrings==0.18.0 -PyVMCON>=2.2.2,<3.0.0 -CoolProp>=6.4 -Jinja2>=3.0 -cvxpy!=1.3.0,!=1.3.1 -seaborn>=0.12.2 + +# f2py requires to read some Fortran code +charset-normalizer>=3.3 diff --git a/requirements_dev.txt b/requirements_dev.txt index ad5a4ac09d..73ea329b05 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,8 +1,11 @@ -black>=22.3.0,<=23.0.0 -flake8>=5.0.4 -flinter==0.3.0 pre-commit>=2.16.0 -pytest>=5.4.1 pytest-cov>=3.0.0 pytest-xdist>=2.5.0 -testbook>=0.4 +mkdocs>=1.1 +mkdocs-material>=4.6.3 +mkdocs-git-revision-date-localized-plugin >= 1.2 +mkdocs-glightbox >= 0.3.4 +pymdown-extensions>=6.3 +bokeh==2.4.0 +mkdocstrings==0.18.0 +Jinja2>=3.0 diff --git a/setup.py b/setup.py index f00fec0e65..ca700977da 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,6 @@ "process": [ "lib/lib*", "fortran*.so", - "data/fluids/*", - "data/h_data/*", - "data/lz_non_corona/*", "data/lz_non_corona_14_elements/*", "utilities/*", ], @@ -39,21 +36,20 @@ "numpy>=1.23", "scipy>=1.10", "cvxpy!=1.3.0,!=1.3.1", - "pandas", + "pandas>=2.0", "tables", "SALib", "numba>=0.57", "PyVMCON>=2.2.2,<3.0.0", "CoolProp>=6.4", + "matplotlib>=2.1.1", "seaborn>=0.12.2", ], - "extras_require": {"test": ["pytest"]}, - "entry_points": { - "console_scripts": [ - "process_script=process.process_script_advanced:main", - "process=process.main:main", - ] + "extras_require": { + "test": ["pytest>=5.4.1", "requests>=2.30", "testbook>=0.4"], + "examples": ["pillow>=5.1.0", "jupyter==1.0.0", "pdf2image==1.16.0"], }, + "entry_points": {"console_scripts": ["process=process.main:main"]}, "extra_link_args": EXTRA_ARGS, } From 1de3c640a1a80ed12e6155c0f09d3f5ac42756a2 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 14:50:44 +0100 Subject: [PATCH 05/11] Remove container usage in ci jobs --- .github/workflows/process.yml | 48 +++++++++++------------------------ 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index 6d6bcce114..db0c69ea6d 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -43,7 +43,7 @@ jobs: name: ford-artifact path: build/ford_project.pickle - unit: + unit-test: runs-on: ubuntu-latest needs: make steps: @@ -69,7 +69,7 @@ jobs: name: unit-coverage-artifacts path: .coverage - integration: + integration-test: runs-on: ubuntu-latest needs: make steps: @@ -91,7 +91,7 @@ jobs: run: pytest tests/integration -n auto -v - regression: + regression-test: runs-on: ubuntu-latest needs: [make, tracking] # depend on make and tracking job, check make job was successful @@ -157,29 +157,17 @@ jobs: name: tracked-mfiles path: tracking/*_MFILE.DAT - flake8: + pre-commit-quality-check: runs-on: ubuntu-latest - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - name: Run Flake8 linter - run: python -m flake8 --tee . - - black: - runs-on: ubuntu-latest - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 - - name: Run Black - run: python -m black --check . + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dev dependencies + run: pip install -r requirements_dev.txt + - name: Run pre-commit + run: pre-commit run --all-files tracking: concurrency: @@ -188,11 +176,6 @@ jobs: runs-on: ubuntu-latest needs: run-tracking-inputs if: github.ref == 'refs/heads/main' - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} env: COMMIT_MESSAGE: ${{ github.event.head_commit.message }} steps: @@ -204,6 +187,8 @@ jobs: path: process/ - name: Install PROCESS run: pip install -e . + - name: Install dev dependencies + run: pip install -r requirements_dev.txt - name: Setup SSH identity uses: webfactory/ssh-agent@v0.7.0 with: @@ -253,11 +238,6 @@ jobs: runs-on: ubuntu-latest needs: tracking if: github.ref == 'refs/heads/main' - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 with: @@ -269,6 +249,8 @@ jobs: path: process/ - name: Install PROCESS run: pip install -e . + - name: Install dev dependencies + run: pip install -r requirements_dev.txt - run: ford documentation/ford/index.md - name: Download ford project uses: actions/download-artifact@v3 From 260a680c06e9e19eda7b724311d52f85fe56b917 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 14:55:49 +0100 Subject: [PATCH 06/11] Resolve pre-commit errors --- process/io/run_process.conf | 2 +- source/fortran/impurity_radiation.f90 | 2 +- source/fortran/iteration_variables.f90 | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/process/io/run_process.conf b/process/io/run_process.conf index 390f619edb..4c2eb6cbcd 100644 --- a/process/io/run_process.conf +++ b/process/io/run_process.conf @@ -16,7 +16,7 @@ ORIGINAL_IN_DAT = PROCESS_DIR/RUN_DIR/STEP_IN.DAT * PROCESS= PROCESS_DIR/bin/process.exe * ONE line comment to be put into README.txt -COMMENT = +COMMENT = * Max no. iterations NITER = 50 diff --git a/source/fortran/impurity_radiation.f90 b/source/fortran/impurity_radiation.f90 index 09815f8467..e282c65eca 100644 --- a/source/fortran/impurity_radiation.f90 +++ b/source/fortran/impurity_radiation.f90 @@ -42,7 +42,7 @@ module impurity_radiation_module !! fimp(nimp) /1.0,0.1,0.02,0.0,0.0,0.0,0.0,0.0,0.0016,0.0,0.0,0.0,0.0,0.0/ : !! impurity number density fractions relative to electron density - !! + !! real(dp), public, dimension(nimp) :: fimp character*2, public, dimension(nimp) :: imp_label diff --git a/source/fortran/iteration_variables.f90 b/source/fortran/iteration_variables.f90 index 1371cd56da..99257e4b04 100755 --- a/source/fortran/iteration_variables.f90 +++ b/source/fortran/iteration_variables.f90 @@ -3849,7 +3849,7 @@ subroutine set_itv_172(ratio) real(kind(1.d0)) :: ratio casths = ratio end subroutine set_itv_172 - + !--------------------------------- ! DUMMY variables below here !--------------------------------- @@ -4116,8 +4116,8 @@ subroutine loadxc case (168); xcm(i) = itv_168() case (169); xcm(i) = itv_169() case (170); xcm(i) = itv_170() - case (171); xcm(i) = itv_171() - case (172); xcm(i) = itv_172() + case (171); xcm(i) = itv_171() + case (172); xcm(i) = itv_172() ! DUMMY Cases case (173); xcm(i) = itv_173() case (174); xcm(i) = itv_174() @@ -4384,7 +4384,7 @@ subroutine convxc(xc,nn) case (169); call set_itv_169(ratio) case (170); call set_itv_170(ratio) case (171); call set_itv_171(ratio) - case (172); call set_itv_172(ratio) + case (172); call set_itv_172(ratio) ! DUMMY Cases case (173); call set_itv_173(ratio) case (174); call set_itv_174(ratio) From 636aa7b64a623b58167b1a6bcb1b282e41afaf25 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 15:17:06 +0100 Subject: [PATCH 07/11] Install optionals in CI --- .github/workflows/process.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index db0c69ea6d..2a01591cbf 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -59,7 +59,7 @@ jobs: - name: Install PROCESS # Editable install to match default install run: | - pip install -e . + pip install -e '.[test, examples]' pip install -r requirements_dev.txt - name: Run unit tests run: pytest --cov=process tests/unit -v @@ -85,7 +85,7 @@ jobs: - name: Install PROCESS # Editable install to match default install run: | - pip install -e . + pip install -e '.[test, examples]' pip install -r requirements_dev.txt - name: Run integration tests run: pytest tests/integration -n auto -v @@ -116,7 +116,7 @@ jobs: - name: Install PROCESS # Editable install to match default install run: | - pip install -e . + pip install -e '.[test, examples]' pip install -r requirements_dev.txt - name: Allow git commands to be run run: sudo git config --system --add safe.directory '*' @@ -126,11 +126,6 @@ jobs: run-tracking-inputs: runs-on: ubuntu-latest needs: make - container: - image: ghcr.io/ukaea/process-ci:latest - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v3 From 15347b238298d110fc933801f61341216ff02d25 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 16:15:21 +0100 Subject: [PATCH 08/11] Install popplerutils for integration tests on CI --- .github/workflows/process.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index 2a01591cbf..aa04ad94aa 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -87,6 +87,10 @@ jobs: run: | pip install -e '.[test, examples]' pip install -r requirements_dev.txt + - name: Install poppler + run: | + sudo apt update + sudo apt install poppler-utils - name: Run integration tests run: pytest tests/integration -n auto -v From 1b1ac5070a1e60d622d6c01d97c1dff95f70a77b Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 23 May 2024 17:20:35 +0100 Subject: [PATCH 09/11] Remove docker support --- docker/ci/Dockerfile | 72 ------------------- docker/dev/Dockerfile | 47 ------------ .../installation/installation-docker.md | 70 ------------------ .../installation/installation-singularity.md | 71 ------------------ .../installation/installation-ubuntu.md | 9 +-- .../proc-pages/installation/introduction.md | 8 +-- mkdocs.yml | 2 - 7 files changed, 2 insertions(+), 277 deletions(-) delete mode 100644 docker/ci/Dockerfile delete mode 100644 docker/dev/Dockerfile delete mode 100644 documentation/proc-pages/installation/installation-docker.md delete mode 100644 documentation/proc-pages/installation/installation-singularity.md diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile deleted file mode 100644 index 14979c7164..0000000000 --- a/docker/ci/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -# Docker image for CI system -FROM ubuntu:20.04 -LABEL description="Process Ubuntu 20.04 image for running CI jobs" - - -# Required to get around interactive timezone prompt -ENV DEBIAN_FRONTEND=noninteractive - - -COPY requirements.txt /tmp/requirements.txt -COPY requirements_dev.txt /tmp/requirements_dev.txt - - -# Install apt packages -# gfortran, debugging tools, git, maths and Latex libraries -# poppler-utils is required by pdf2image -# This syntax is recommended by Docker to bust caching -RUN apt-get update && apt-get install -y \ - gdb \ - gfortran \ - git \ - graphviz \ - libblas-dev \ - liblapack-dev \ - liblapack3 \ - pandoc \ - poppler-utils \ - python3-pip \ - python-is-python3 \ - texlive-base \ - texlive-font-utils \ - texlive-latex-extra \ - lcov \ - cmake \ - bc - - -# Install apt packages for pyenv. -RUN apt-get install -y \ - build-essential \ - curl \ - libbz2-dev \ - libffi-dev \ - liblzma-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libreadline-dev \ - libsqlite3-dev \ - libssl-dev \ - llvm \ - python-openssl \ - tk-dev \ - wget \ - xz-utils \ - zlib1g-dev - - -# Install pyenv. -RUN curl https://pyenv.run | bash -ENV PYENV_ROOT /root/.pyenv -ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/versions/3.10.14/bin:$PATH - -RUN pyenv install 3.10.14 && \ - pyenv global 3.10.14 - - -RUN python -m pip install --upgrade pip && \ - python -m pip install -r /tmp/requirements.txt && \ - python -m pip install -r /tmp/requirements_dev.txt && \ - python -m pip install git+https://github.com/jonmaddock/ford - -RUN git clone https://github.com/jmorris-uk/anybadge.git /root/anybadge/ && pip install anybadge diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile deleted file mode 100644 index 717647330c..0000000000 --- a/docker/dev/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -# Development image for Process, used in challenging environments to give -# identical results to CI or to quickly provide a working environment to a -# casual user. Differs from CI image by not using virtual environments for -# differt Python versions and doesn't require the CI script to perform extra -# installations -FROM ubuntu:20.04 -LABEL description="Process development image" - -# Required to get around interactive timezone prompt -ENV DEBIAN_FRONTEND=noninteractive -ENV FC=gfortran - -# Install apt packages -# poppler-utils is required by pdf2image -RUN apt-get update && apt-get install -y \ - gdb \ - gfortran \ - git \ - graphviz \ - libblas-dev \ - liblapack-dev \ - liblapack3 \ - poppler-utils \ - python3-pip \ - python-is-python3 \ - libhdf5-serial-dev \ - netcdf-bin \ - libnetcdf-dev - -# Install Python packages into a virtual environment -# Use virtualenv to prevent "running pip as root" warnings -RUN python -m pip install --upgrade pip && \ - python -m pip install \ - cmake \ - Markdown \ - matplotlib \ - mkdocs \ - mkdocs-material \ - netCDF4 \ - numpy \ - pathlib \ - pillow \ - pymdown-extensions \ - pytest \ - scipy \ - toposort \ - wheel diff --git a/documentation/proc-pages/installation/installation-docker.md b/documentation/proc-pages/installation/installation-docker.md deleted file mode 100644 index 3a9e966107..0000000000 --- a/documentation/proc-pages/installation/installation-docker.md +++ /dev/null @@ -1,70 +0,0 @@ -# Installation using Docker - -!!! Note "Note" - This section is for users of a privileged machine of the wrong OS e.g MacOS. If you are a using a shared resource e.g. computing cluster, please go [here](https://ukaea.github.io/PROCESS/installation/installation-singularity/).* - -PROCESS can be run on Mac or in other environments inside a Docker container. The PROCESS -repository, including source and build directories, remain in the host filesystem, but the -building and running of PROCESS is performed inside the container. This ensures that PROCESS -produces the same results as in other fully-supported environments, such as the CI system. The -Ubuntu-based development image used is similar to the one used on the CI system, but it is -designed to work immediately with no further installations. - -!!! Note "Docker licence" - Please note due to recent changes in the Docker Desktop ToS, you will require either a Docker - Desktop license to run on Mac, or you will require a Linux environment by other means, such - as a virtual machine. - -Firstly, [install Docker](https://docs.docker.com/get-docker/). On Mac, this can be accomplished -using `homebrew`: - -``` -brew --cask install docker -``` - -Then download the Docker image from the Process Gitlab container registry: - -``` -docker pull ghcr.io/ukaea/process-ci:latest -``` - -Running `docker image ls` should show the image in your local Docker image repository. Optionally, -you can change the image name to something more manageable: - -``` -docker tag ghcr.io/ukaea/process-ci:latest process-dev -``` - -to rename the image to "process-dev" with the "latest" tag: "process:latest". - -Now run the container: - -``` -docker run -it -v ~/process:/root/process process-dev -``` - -This runs a container which is an instance of the process-dev image. `-it` runs the container in -interactive mode (`-i`, allows `stdin`) with a terminal (`-t`, allows bash-like interaction). `-v` -specifies the bind mount to use; mount the host `~/process` directory to the `/root/process` -directory in the container. This means that the container has read and write access to the `process` -project directory on the host filesystem and will stay in sync with it. Please be aware that -changes made in a Docker container outside of mounted folders will not be saved on exiting the container. - -Now the container is running, configure, clean and build from the project root directory inside the container: - -``` -cd ~/process -cmake -S . -B build -cmake --build build --clean-first -``` - -The clean step is required to remove any build targets or caches from previous host builds to ensure -a completely fresh build from inside the container. This is only required when using the container -for the first time. - -Once PROCESS has built inside the container, it can be tested (as in the following section) by -running `pytest`. Once the test suite passes, this confirms that your Docker container runs PROCESS -with the same results as the CI system. PROCESS can now be developed and run as before, with the -build and running taking place inside the container. - -There is also a VS Code extension for Docker containers that may be helpful. diff --git a/documentation/proc-pages/installation/installation-singularity.md b/documentation/proc-pages/installation/installation-singularity.md deleted file mode 100644 index b90b4b2c34..0000000000 --- a/documentation/proc-pages/installation/installation-singularity.md +++ /dev/null @@ -1,71 +0,0 @@ - - -# Installation using Singularity/Apptainer container - -Singularity is a container environment similar to Docker. This means a user can run PROCESS with -all required dependencies installed. Singularity, however, is designed to work with user-level -permissions and, as such, is supported by many shared resource administrators (unlike Docker, -which poses a security risk). - -Singularity can convert OCI compliant containers into the Singularity Image Format (SIF) to run -the Docker container above. Download, and convert the Docker container by running: - -```bash -apptainer pull process.sif docker://ghcr.io/ukaea/process-ci:latest -``` - -Singularity will then ask for a username and password, your CCFE GitLab short username and -password. Singularity will write the container into your current directory, it can then be moved or -copied like any file. Running the following command will load a Singularity shell with the -dependencies for PROCESS installed: - -```bash -apptainer shell process.sif -``` - -Singularity will automatically mount your home (`$HOME`) directory into the container. Therefore, -if PROCESS lives in `~/process` on your system, it will also live inside of `~/process` in the -shell environment. - -It should also be noted that while the Singularity container has a Python 3.8 by default, it will -be impossible to pip install any packages without getting a `Read-only file system` error. This is -because you are treated as a non-admin user within the container, and, as such, you cannot update -the system Python. For this reason, it is recommended that you still use a virtual environment -within the Singularity container (as described above). `pip install --user` will work; -however, it will cause conflicts with existing Python packages you have installed outside of your container. - -

Steps to use Singularity to install PROCESS on Freia

- -Log onto Freia and make sure the Singularity module is loaded - -```bash -module load singularity/3.7.1 -``` - -Pull the Singularity image and enter your git username and password when prompted: - -```bash -apptainer pull process.sif docker://ghcr.io/ukaea/process-ci:latest -``` - -Make sure you have created [ssh keys](https://docs.gitlab.com/ee/ssh/) and open the Singularity shell: - -```bash -apptainer shell process.sif -``` - -Singularity is an environment which allows you to use dependencies not available on Freia, like -the correct versions of Python and cmake. With the shell open, the installation of PROCESS can proceed as usual: - -```bash -git clone git@git.ccfe.ac.uk:process/process.git -cd process -python3 -m venv env --without-pip --system-site-packages -source env/bin/activate -export PATH=$PATH:~USERNAME/.local/bin/ -cmake -S . -B build -cmake --build build -``` - -Now you can run commands within the shell like `process -i tests/regression/scenarios/large-tokamak/IN.DAT` -to verify installation and create [batch jobs](https://ukaea.github.io/PROCESS/io/utilities/). diff --git a/documentation/proc-pages/installation/installation-ubuntu.md b/documentation/proc-pages/installation/installation-ubuntu.md index 73248a39e0..413324a727 100644 --- a/documentation/proc-pages/installation/installation-ubuntu.md +++ b/documentation/proc-pages/installation/installation-ubuntu.md @@ -16,11 +16,6 @@ PROCESS is developed using Ubuntu 22 and tested using Ubuntu 20. We cannot guara If the above procedure fails to work, there is a [Microsoft help page](https://learn.microsoft.com/en-us/windows/wsl/install). -!!! Info "Users on unsupported OS'" - Other users may find benefit in our [Docker installation guide](https://ukaea.github.io/PROCESS/installation/installation-docker/) if they are on a machine which they have admin privledges. - - Users of shared resources should see our [Singularity/Apptainer installation guide](https://ukaea.github.io/PROCESS/installation/installation-singularity/). - GFortran version 9 or above is needed for successful installation and execution of PROCESS. Versions below GFortran-9 will be rejected by CMake by default since, while PROCESS might compile @@ -113,9 +108,7 @@ which runs unit, integration, and regression tests. A more in-depth discussion of testing can be found [here](https://ukaea.github.io/PROCESS/development/testing/). If everything passes, this indicates a successful installation. If anything fails, this indicates -that your environment produces different results to what is expected. You might consider -creating an issue in GitHub, or trying out the -[Docker container](https://ukaea.github.io/PROCESS/installation/installation-docker/) instead. +that your environment produces different results to what is expected. !!! Question "Installation troubleshooting" diff --git a/documentation/proc-pages/installation/introduction.md b/documentation/proc-pages/installation/introduction.md index 2627f39fdb..3cbdca3e6c 100644 --- a/documentation/proc-pages/installation/introduction.md +++ b/documentation/proc-pages/installation/introduction.md @@ -6,10 +6,4 @@ different operating systems. PROCESS is natively supported on Ubuntu 20 and 22, and requires Python 3.8 or greater. Other Linux distributions will be able to successfully build and execute PROCESS however may give inconsistent results due to version disparities of -dynamically linked libraries; therefore these can't be guaranteed. To install on Ubuntu, please follow the [installation guide](installation-ubuntu.md). - -Additionally, there are three supported ways to run PROCESS on a non-native Ubuntu 22.04 machine: - -1. WSL (Windows Subsystem for Linux- if you are a Windows user) --> [guide](installation-ubuntu.md) -2. Docker (for users on privileged machines that are of the wrong OS) --> [guide](installation-docker.md) -3. Singularity (mainly for use on shared resources e.g. Freia) --> [guide](installation-singularity.md) +dynamically linked libraries; therefore these can't be guaranteed. To install on Ubuntu, Mac, or Windows, please follow the [installation guide](installation-ubuntu.md). diff --git a/mkdocs.yml b/mkdocs.yml index f45c394889..ce4f2f254a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,8 +7,6 @@ nav: - Installation: - Introduction: installation/introduction.md - Installation on Ubuntu/Windows: installation/installation-ubuntu.md - - Installation using Docker: installation/installation-docker.md - - Installation using Singularity: installation/installation-singularity.md - Installation on CSD3: installation/csd3-for-process.md - Visual Studio Code: installation/vs-code.md - Usage: From 97b8281331476fe4a2e9f9cfd12859c370fd519f Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Fri, 24 May 2024 11:15:11 +0100 Subject: [PATCH 10/11] Install ford in docs job --- .github/workflows/process.yml | 2 ++ mkdocs.yml | 50 +++++++++++++++++------------------ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index aa04ad94aa..13a23f4c34 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -250,6 +250,8 @@ jobs: run: pip install -e . - name: Install dev dependencies run: pip install -r requirements_dev.txt + - name: Install ford + run: pip install git+https://github.com/jonmaddock/ford - run: ford documentation/ford/index.md - name: Download ford project uses: actions/download-artifact@v3 diff --git a/mkdocs.yml b/mkdocs.yml index ce4f2f254a..34df803d4e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -69,31 +69,31 @@ nav: - Shield: eng-models/shield.md - Divertor: eng-models/divertor.md - Heat transport: eng-models/power-conversion-and-heat-dissipation-systems.md - - Auxiliary Heating & Current Drive Systems: - - Overview: eng-models/heating_and_current_drive/heating-and-current-drive.md - - Radio Frequency: - - Overview: eng-models/heating_and_current_drive/RF/rf_overview.md - - Lower Hybrid: - - Overview: eng-models/heating_and_current_drive/RF/lhcd_overview.md - - Fenstermacher Model: eng-models/heating_and_current_drive/RF/fenstermacher_lower_hybrid.md - - Ehst Model: eng-models/heating_and_current_drive/RF/ehst_lower_hybrid.md - - Culham Model: eng-models/heating_and_current_drive/RF/culham_lower_hybrid.md - - Electron Cyclotron: - - Overview: eng-models/heating_and_current_drive/RF/ec_overview.md - - Fenstermacher Resonnance Model: eng-models/heating_and_current_drive/RF/fenstermacher_electron_cyclotron_resonance.md - - Culham Model: eng-models/heating_and_current_drive/RF/culham_electron_cyclotron.md - - User Input Gamma Model: eng-models/heating_and_current_drive/RF/ecrh_gamma.md - - Cutoff mode: eng-models/heating_and_current_drive/RF/cutoff_ecrh.md - - Ion Cyclotron: - - Overview: eng-models/heating_and_current_drive/RF/ic_overview.md - - Ion cyclotron model: eng-models/heating_and_current_drive/RF/ic_model.md - - Electron Bernstein Wave: - - Overview: eng-models/heating_and_current_drive/RF/ebw_overview.md - - EBW Model: eng-models/heating_and_current_drive/RF/ebw_freethy.md - - Neutral Beam Injection: - - Overview: eng-models/heating_and_current_drive/NBI/nbi_overview.md - - ITER Model: eng-models/heating_and_current_drive/NBI/iter_nb.md - - Culham Model: eng-models/heating_and_current_drive/NBI/culham_nb.md + - Auxiliary Heating & Current Drive Systems: + - Overview: eng-models/heating_and_current_drive/heating-and-current-drive.md + - Radio Frequency: + - Overview: eng-models/heating_and_current_drive/RF/rf_overview.md + - Lower Hybrid: + - Overview: eng-models/heating_and_current_drive/RF/lhcd_overview.md + - Fenstermacher Model: eng-models/heating_and_current_drive/RF/fenstermacher_lower_hybrid.md + - Ehst Model: eng-models/heating_and_current_drive/RF/ehst_lower_hybrid.md + - Culham Model: eng-models/heating_and_current_drive/RF/culham_lower_hybrid.md + - Electron Cyclotron: + - Overview: eng-models/heating_and_current_drive/RF/ec_overview.md + - Fenstermacher Resonnance Model: eng-models/heating_and_current_drive/RF/fenstermacher_electron_cyclotron_resonance.md + - Culham Model: eng-models/heating_and_current_drive/RF/culham_electron_cyclotron.md + - User Input Gamma Model: eng-models/heating_and_current_drive/RF/ecrh_gamma.md + - Cutoff mode: eng-models/heating_and_current_drive/RF/cutoff_ecrh.md + - Ion Cyclotron: + - Overview: eng-models/heating_and_current_drive/RF/ic_overview.md + - Ion cyclotron model: eng-models/heating_and_current_drive/RF/ic_model.md + - Electron Bernstein Wave: + - Overview: eng-models/heating_and_current_drive/RF/ebw_overview.md + - EBW Model: eng-models/heating_and_current_drive/RF/ebw_freethy.md + - Neutral Beam Injection: + - Overview: eng-models/heating_and_current_drive/NBI/nbi_overview.md + - ITER Model: eng-models/heating_and_current_drive/NBI/iter_nb.md + - Culham Model: eng-models/heating_and_current_drive/NBI/culham_nb.md - Cryostat and vacuum system: eng-models/cryostat-and-vacuum-system.md - Plant Availability: eng-models/plant-availability.md - Power Requirements: eng-models/power-requirements.md From 18fc6c94b03eff3c748a4d3360916d2e5f698a73 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Fri, 9 Aug 2024 09:43:54 +0000 Subject: [PATCH 11/11] Update documentation on dependency changes --- documentation/proc-pages/development/numba.md | 2 +- .../proc-pages/development/pre-commit.md | 2 +- .../installation/csd3-for-process.md | 2 +- .../installation/installation-ubuntu.md | 36 ++++++++++++------- mkdocs.yml | 34 +++++++++--------- requirements.txt | 3 ++ requirements_dev.txt | 3 ++ 7 files changed, 50 insertions(+), 32 deletions(-) diff --git a/documentation/proc-pages/development/numba.md b/documentation/proc-pages/development/numba.md index 0a309123ca..89c1b40636 100644 --- a/documentation/proc-pages/development/numba.md +++ b/documentation/proc-pages/development/numba.md @@ -90,7 +90,7 @@ First ensure that `gprof2dot` is installed by issuing the command `pip install g Execute the following commands from the PROCESS root directory: ```bash -> python3.8 -m cProfile -o large-tok.pstats process/main.py -i tests/regression/scenarios/large-tokamak/IN.DAT +> python3 -m cProfile -o large-tok.pstats process/main.py -i tests/regression/scenarios/large-tokamak/IN.DAT > gprof2dot -f pstats large-tok.pstats | dot -Tpng -o large_tokamak_profile.png ``` diff --git a/documentation/proc-pages/development/pre-commit.md b/documentation/proc-pages/development/pre-commit.md index 3fda3667b6..83aac78c64 100755 --- a/documentation/proc-pages/development/pre-commit.md +++ b/documentation/proc-pages/development/pre-commit.md @@ -39,7 +39,7 @@ pre-commit -h If pre-commit is not installed, then it can be installed by: ```bash -python3.8 -m pip install pre-commit +python3 -m pip install pre-commit ``` For developers of PROCESS diff --git a/documentation/proc-pages/installation/csd3-for-process.md b/documentation/proc-pages/installation/csd3-for-process.md index 52d2f8161d..d0114783af 100644 --- a/documentation/proc-pages/installation/csd3-for-process.md +++ b/documentation/proc-pages/installation/csd3-for-process.md @@ -43,7 +43,7 @@ conda create --name my_process conda activate my_process ``` -It is worth checking that a compatible version of python has been installed (Python3.8 or 3.10). You can check this by entering `which python` into the terminal. You can install a compatible version of python with the command `conda install python=3.10`. +It is worth checking that a compatible version of python has been installed (Python3.10 or 3.11). You can check this by entering `which python` into the terminal. You can install a compatible version of python with the command `conda install python=3.10`. Next, install gfortran. diff --git a/documentation/proc-pages/installation/installation-ubuntu.md b/documentation/proc-pages/installation/installation-ubuntu.md index 413324a727..661f30c010 100644 --- a/documentation/proc-pages/installation/installation-ubuntu.md +++ b/documentation/proc-pages/installation/installation-ubuntu.md @@ -1,5 +1,5 @@ # Installation on Ubuntu/Windows -PROCESS is developed using Ubuntu 22 and tested using Ubuntu 20. We cannot guarantee any other operating system will be able to compile PROCESS or reproduce results. We do unofficially support MacOS however PROCESS is **not** currently tested on this OS by the CI system. +PROCESS is developed using Ubuntu 22 and tested using Ubuntu 20. We cannot guarantee any other operating system will be able to compile PROCESS or reproduce results. PROCESS is known to build on some versions of MacOS, however, PROCESS is **not** supported or tested on MacOS. !!! Info "Windows User" Windows users should run PROCESS using WSL. @@ -16,6 +16,7 @@ PROCESS is developed using Ubuntu 22 and tested using Ubuntu 20. We cannot guara If the above procedure fails to work, there is a [Microsoft help page](https://learn.microsoft.com/en-us/windows/wsl/install). +## Installing PROCESS GFortran version 9 or above is needed for successful installation and execution of PROCESS. Versions below GFortran-9 will be rejected by CMake by default since, while PROCESS might compile @@ -28,6 +29,10 @@ sudo apt update sudo apt install -y cmake gfortran python3-pip lcov poppler-utils python3-venv ``` +!!! Note "CMake" + CMake can also be installed into your (virtual) Python environment by running `pip install cmake`. + + Next, the code will need to be downloaded so you can work with it. The PROCESS code is stored in a GitHub repository and as such needs to be 'cloned' - i.e bought to your VSCode window from GitHub. @@ -69,17 +74,27 @@ cmake -S . -B build cmake --build build ``` -If you plan on developing code for PROCESS, please see the `pre-commit` documentation for -installing this tool required by developers: [development/pre-commit](http://process.gitpages.ccfe.ac.uk/process/development/pre-commit/) - The build step may take some time when run for the first time (~3 mins) as the Fortran code is compiled and then wrapped using `f2py` to create the Python libraries. Once this is completed the PROCESS Python package is then automatically installed using `pip` and should be ready to use -on Linux. If the installation was successful the command `process` should be available on the command line. +on Linux. If the installation was successful the `process` command should be available on the command line. To rebuild, for example after making a change to the Fortran source, run `cmake --build build` again. Python-only changes are reflected immediately, as the `cmake` build script performs a development (editable) installation by default. +## Examples + +If you are new to PROCESS, you may want to run some of the examples in the `examples/` directory. These will introduce you to the basic functionality of reactor design with PROCESS. The examples require additional dependencies that can be installed using: +``` +pip install '.[examples]' +``` + +## PROCESS Development + +If you plan on developing code for PROCESS, please see the `pre-commit` documentation for +installing this tool required by developers: [development/pre-commit](http://process.gitpages.ccfe.ac.uk/process/development/pre-commit/). + + !!! warning "Users of multiple branches" For users of PROCESS that run on multiple branches, it is recommended that each time you switch branches you **fully rebuild** PROCESS: ```bash @@ -89,12 +104,9 @@ Python-only changes are reflected immediately, as the `cmake` build script perfo ``` The PROCESS test suite provides through tests that can be used to confirm a successful installation; -the tests can then be used to verify changes you make have not affected the wider codebase. - -Firstly, ensure you are in the PROCESS root directory. - -```BASH -cd PROCESS +the tests can then be used to verify changes you make have not affected the wider codebase. The tests should be run from the PROCESS root directory. The tests require additional requirements installed by running: +``` +pip install '.[examples, test]' ``` The test suite uses PyTest and can be fully run using: @@ -191,5 +203,5 @@ that your environment produces different results to what is expected. E.g. ```bash - sudo apt install libpython3.8-dev + sudo apt install libpython3.10-dev ``` diff --git a/mkdocs.yml b/mkdocs.yml index 34df803d4e..9a9290374e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,23 +40,23 @@ nav: # - Versioning: development/versioning.md - Reference: - Physics Models: - - Plasma: - - Overview: physics-models/plasma_overview.md - - Geometry: physics-models/plasma_geometry.md - - Profiles: - - Overview: physics-models/profiles/plasma_profiles.md - - Density Profile: physics-models/profiles/plasma_density_profile.md - - Temperature Profile: physics-models/profiles/plasma_temperature_profile.md - - Profile Base Class: physics-models/profiles/plasma_profiles_abstract_class.md - - Fusion Reactions: physics-models/plasma_reactions.md - - Beta Limit: physics-models/plasma_beta.md - - Fast Alpha: physics-models/plasma_alpha.md - - Density Limit: physics-models/plasma_density.md - - Composition & Impurities: physics-models/plasma_radiation_impurities.md - - Radiation: physics-models/plasma_radiation_impurities.md - - Plasma Current: physics-models/plasma_current.md - - Confinement time: physics-models/plasma_confinement.md - - Plasma Core Power Balance: physics-models/plasma_power_balance.md + - Plasma: + - Overview: physics-models/plasma_overview.md + - Geometry: physics-models/plasma_geometry.md + - Profiles: + - Overview: physics-models/profiles/plasma_profiles.md + - Density Profile: physics-models/profiles/plasma_density_profile.md + - Temperature Profile: physics-models/profiles/plasma_temperature_profile.md + - Profile Base Class: physics-models/profiles/plasma_profiles_abstract_class.md + - Fusion Reactions: physics-models/plasma_reactions.md + - Beta Limit: physics-models/plasma_beta.md + - Fast Alpha: physics-models/plasma_alpha.md + - Density Limit: physics-models/plasma_density.md + - Composition & Impurities: physics-models/plasma_radiation_impurities.md + - Radiation: physics-models/plasma_radiation_impurities.md + - Plasma Current: physics-models/plasma_current.md + - Confinement time: physics-models/plasma_confinement.md + - Plasma Core Power Balance: physics-models/plasma_power_balance.md - Pulsed Plant Operation: physics-models/pulsed-plant.md - Engineering Models: - Machine Build: eng-models/machine-build.md diff --git a/requirements.txt b/requirements.txt index 7c018584a9..4a0ac4d6bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +# requirements.txt includes the dependencies necessary for running the PROCESS build system +# (cmake --build build). + # numpy is required for some of the install scripts numpy>=1.23 diff --git a/requirements_dev.txt b/requirements_dev.txt index 73ea329b05..221cc3a397 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,3 +1,6 @@ +# requirements_dev.txt includes the dependencies for running scripts on the CI +# e.g. documentation building and quality assurance (pre-commit). + pre-commit>=2.16.0 pytest-cov>=3.0.0 pytest-xdist>=2.5.0