From fae504a199fc054eb8411a710d46fb339ee8dfde Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 28 Nov 2024 08:34:54 +0100 Subject: [PATCH] Swig container (#1020) Updated the weekly build of docker containers: - change to relative path in the COPY statements of the Dockerfiles generated with gen_dockerfile.sh - reduce number of build containers to 4: manylinux/musllinux, i686/x86_64 - parametrised python versions - installed rust and cargo on musllinux and manylinux2014 - updated ci_build_wheels to match the reduced number of containers that are build - install SWIG with pip instead of via the linux distribution to ensure a consistent swig version - avoid that split_url() and split_meta_uri() returns and extra None argument with SWIG 4.3.0 This PR combines PR #1017 and #1019. It should be followed up by a PR adding support for Python 3.13 and more included dependencies like pydantic, paramiko, pandas, ... (except for manylinux2014) --- .github/docker/Dockerfile-manylinux.template | 40 +++----- .../docker/Dockerfile-manylinux_x_y.template | 32 +++--- .github/docker/Dockerfile-musllinux.template | 26 +++-- .github/docker/gen_dockerfile.sh | 28 ++++-- .github/workflows/cd_docs.yml | 14 +-- .github/workflows/ci_build_wheels.yml | 97 ++++++++++--------- .github/workflows/ci_tests.yml | 1 - .github/workflows/container_builds_weekly.yml | 64 +++++++----- bindings/python/dlite-misc.i | 25 +++-- doc/contributors_guide/tips_and_tricks.md | 10 +- doc/getting_started/installation.md | 36 ++----- python/setup.py | 14 ++- requirements_dev.txt | 3 +- requirements_full.txt | 2 +- src/config-paths.h.in | 8 ++ 15 files changed, 222 insertions(+), 178 deletions(-) diff --git a/.github/docker/Dockerfile-manylinux.template b/.github/docker/Dockerfile-manylinux.template index c90bb0376..cda258815 100644 --- a/.github/docker/Dockerfile-manylinux.template +++ b/.github/docker/Dockerfile-manylinux.template @@ -1,12 +1,17 @@ # -*- Mode: Dockerfile -*- -# Template Dockerfile for building Python pypi package. Going to be -# superseeded by Dockerfile-manylinux_x_y.template +# Template Dockerfile for manylinux 2010 and 2014 for building Python pypi package. +# Is superseeded by the Dockerfile-manylinux_x_y.template, but will continue to be used to support i686 architectures. +# +# On these old systems we do not install requirements_full.txt # # Usage: # # Copy this template file and replace: # - `{{ TYPE }}` major glibc version, ex: _2_24, _2_28 -# - `{{ ARCH }}` with a valid arch, ex: x86_64, i686 +# - `{{ ARCH }}` architecture, ex: x86_64, i686 +# - `{{ PY_MINORS }}` minor Python3 version numbers, ex: "8 9 10" +# - `{{ EXTRA_PRE }}` extra commands before installation +# - `{{ EXTRA_POST }}` extra commands after installation # Remove the `.template` suffix from the copy. # # Examples @@ -35,9 +40,7 @@ # Reference: https://github.com/pypa/manylinux#manylinux2014-centos-7-based FROM quay.io/pypa/manylinux{{ TYPE }}_{{ ARCH }}:latest -ARG PY_MINORS="8 9 10 11 12" - -COPY requirements_full.txt requirements_dev.txt /tmp/ +COPY requirements.txt requirements_full.txt requirements_dev.txt /tmp/ {{ EXTRA_PRE }} @@ -48,7 +51,6 @@ RUN \ https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm --eval %{centos_ver}).noarch.rpm \ https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm --eval %{centos_ver}).noarch.rpm && \ yum install -y \ - swig \ redland-devel \ rasqal-devel \ libcurl-devel \ @@ -65,20 +67,11 @@ RUN \ # Filter out challenging packages from requirements sed \ -e '/mongomock/d' \ - -i /tmp/requirements_dev.txt && \ - sed \ - -e '/pandas/d' \ - -e '/pyarrow/d' \ - -e '/tables/d' \ - -e '/openpyxl/d' \ - -e '/jinja2/d' \ - -e '/pydantic/d' \ - -e '/fortran-language-server/d' \ - -e '/matplotlib/d' \ - -e '/scikit-image/d' \ - -e '/ncempy/d' \ - -e '/h5py/d' \ - -i /tmp/requirements_full.txt && \ + -i /tmp/requirements_dev.txt + +ARG PY_MINORS="{{ PY_MINORS }}" + +RUN \ # Install required Python packages mkdir -p /ci/pip_cache && \ for minor in ${PY_MINORS}; do \ @@ -86,9 +79,8 @@ RUN \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ -U setuptools wheel && \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ - oldest-supported-numpy \ - -r /tmp/requirements_dev.txt \ - -r /tmp/requirements_full.txt; \ + -r /tmp/requirements.txt \ + -r /tmp/requirements_dev.txt; \ done && \ rm -rf /ci/pip_cache diff --git a/.github/docker/Dockerfile-manylinux_x_y.template b/.github/docker/Dockerfile-manylinux_x_y.template index 048a4a875..099c142f7 100644 --- a/.github/docker/Dockerfile-manylinux_x_y.template +++ b/.github/docker/Dockerfile-manylinux_x_y.template @@ -5,8 +5,11 @@ # Usage: # # Copy this template file and replace: -# - `{{ TYPE }}` major glibc version, ex: _2_24, _2_28 -# - `{{ ARCH }}` with a valid arch, ex: x86_64, i686 +# - `{{ TYPE }}` major glibc version, ex: _2_24, _2_28, _2_34 +# - `{{ ARCH }}` architecture, ex: x86_64, i686 +# - `{{ PY_MINORS }}` minor Python3 version numbers, ex: "8 9 10 11 12 13" +# - `{{ EXTRA_PRE }}` extra commands before installation +# - `{{ EXTRA_POST }}` extra commands after installation # Remove the `.template` suffix from the copy. # # Examples @@ -14,32 +17,30 @@ # # Generate dockerfile: # -# .github/docker/gen_dockerfile.sh manylinux _2_24 x86_64 > \ -# .github/docker/dockerfiles/Dockerfile-manylinux_2_24_x86_64 +# .github/docker/gen_dockerfile.sh manylinux _2_34 x86_64 > \ +# .github/docker/dockerfiles/Dockerfile-manylinux_2_34_x86_64 # # Build: # # cd dlite # cd to DLite root directory -# docker build -t dlite-manylinux \ -# -f .github/docker/dockerfiles/Dockerfile-manylinux_2_24_x86_64 . +# docker build -t dlite-manylinux_2_34_x86_64 \ +# -f .github/docker/dockerfiles/Dockerfile-manylinux_2_34_x86_64 . # # Run (for debugging): # # docker run --rm -it \ # --volume $PWD:/io \ # --user $(id -u):$(id -g) \ -# dlite-manylinux_2_24_x86_64 \ +# dlite-manylinux_2_34_x86_64 \ # /bin/bash # # Reference: https://github.com/pypa/manylinux FROM quay.io/pypa/manylinux{{ TYPE }}_{{ ARCH }}:latest -ARG PY_MINORS="8 9 10 11 12" - {{ EXTRA_PRE }} -COPY requirements_full.txt requirements_dev.txt /tmp/ +COPY requirements.txt requirements_full.txt requirements_dev.txt /tmp/ # Enable rpmfusion for additional packages RUN \ @@ -50,7 +51,6 @@ RUN \ dnf install -y \ redland-devel \ rasqal-devel \ - swig \ libcurl-devel \ libxslt-devel \ libxml2-devel \ @@ -59,21 +59,25 @@ RUN \ # It's necessary to be in /opt/_internal because the internal libraries # exist here. cd /opt/_internal && \ - tar -Jxvf static-libs-for-embedding-only.tar.xz && \ + tar -Jxvf static-libs-for-embedding-only.tar.xz # Filter out challenging packages from requirements_full.txt #sed \ # -e '/pyarrow/d' \ # -e '/tables/d' \ # -e '/scikit-image/d' \ # -i /tmp/requirements_full.txt && \ - # Install required Python packages + # Install required Python packages + +ARG PY_MINORS="{{ PY_MINORS }}" + +RUN \ mkdir -p /ci/pip_cache && \ for minor in ${PY_MINORS}; do \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache -U pip && \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ -U setuptools wheel && \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ - oldest-supported-numpy \ + -r /tmp/requirements.txt \ -r /tmp/requirements_dev.txt \ -r /tmp/requirements_full.txt; \ done && \ diff --git a/.github/docker/Dockerfile-musllinux.template b/.github/docker/Dockerfile-musllinux.template index 136a730c8..308bd9199 100644 --- a/.github/docker/Dockerfile-musllinux.template +++ b/.github/docker/Dockerfile-musllinux.template @@ -5,7 +5,10 @@ # # Copy this template file and replace: # - `{{ TYPE }}` with a valid musllinux type, e.g. '_1_1' or '_1_2' -# - `{{ ARCH }}` with a valid arch, e.g., x86_64 or i686 +# - `{{ ARCH }}` architecture, ex: x86_64, i686 +# - `{{ PY_MINORS }}` minor Python3 version numbers, ex: "8 9 10 11 12" +# - `{{ EXTRA_PRE }}` extra commands before installation +# - `{{ EXTRA_POST }}` extra commands after installation # Remove the `.template` suffix from the copy. # # Examples @@ -32,9 +35,7 @@ # FROM quay.io/pypa/musllinux{{ TYPE }}_{{ ARCH }}:latest -ARG PY_MINORS="8 9 10 11 12" - -COPY requirements_full.txt requirements_dev.txt /tmp/ +COPY requirements.txt requirements_full.txt requirements_dev.txt /tmp/ {{ EXTRA_PRE }} @@ -50,13 +51,16 @@ RUN \ hdf5-dev \ openssl-dev \ openblas-dev \ - swig && \ + swig \ + rust \ + cargo && \ # Unpack static libraries # It's necessary to be in /opt/_internal because the internal libraries # exist here. cd /opt/_internal && \ tar -Jxvf static-libs-for-embedding-only.tar.xz && \ # Filter out challenging packages from requirements_full.txt + #-e 's/^pydantic.*/pydantic<2/' \ sed \ -e '/pandas/d' \ -e '/pyarrow/d' \ @@ -67,8 +71,16 @@ RUN \ -e '/scikit-image/d' \ -e '/ncempy/d' \ -e '/h5py/d' \ + -e '/pymongo/d' \ + -e '/fortran-language-server/d' \ -i /tmp/requirements_full.txt && \ - #-e 's/^pydantic.*/pydantic<2/' \ + sed \ + -e '/mongomock/d' \ + -i /tmp/requirements_dev.txt + +ARG PY_MINORS="{{ PY_MINORS }}" + +RUN \ # Install required Python packages mkdir -p /ci/pip_cache && \ for minor in ${PY_MINORS}; do \ @@ -76,7 +88,7 @@ RUN \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ -U setuptools wheel && \ python3.${minor} -m pip install --cache-dir=/ci/pip_cache \ - oldest-supported-numpy \ + -r /tmp/requirements.txt \ -r /tmp/requirements_dev.txt \ -r /tmp/requirements_full.txt; \ done && \ diff --git a/.github/docker/gen_dockerfile.sh b/.github/docker/gen_dockerfile.sh index ba382a792..376c22f91 100755 --- a/.github/docker/gen_dockerfile.sh +++ b/.github/docker/gen_dockerfile.sh @@ -3,42 +3,50 @@ # # Usage: # -# gen_dockerfile.sh SYSTEM SYSTEM_TYPE ARCH +# gen_dockerfile.sh SYSTEM SYSTEM_TYPE ARCH [PY_MINORS] # # Arguments: -# SYSTEM: system type. Ex: manylinux, musllinux -# SYSTEM_TYPE: Ex: 2010, 2014, _2_24, _2_28 (manylinux), _1_1, _1_2 (musllinux) -# ARCH: Ex: x86_64, i686 +# SYSTEM: system. Ex: manylinux, musllinux +# SYSTEM_TYPE: System type. Ex: 2010, 2014, _2_24, _2_28 (manylinux), _1_1, _1_2 (musllinux) +# ARCH: Architecture. Ex: x86_64, i686 +# PY_MINORS: Optional list of Python3 minor version numbers. Default: "8 9 10 11 12" set -eu -if [[ $# -ne 3 ]]; then - echo "Usage: gen_dockerfile.sh SYSTEM SYSTEM_TYPE ARCH" +if [[ $# -lt 3 ]]; then + echo "Usage: gen_dockerfile.sh SYSTEM SYSTEM_TYPE ARCH [PY_MINORS]" exit 1 fi SYSTEM=$1 SYSTEM_TYPE=$2 ARCH=$3 +if [[ $# -ge 4 ]]; then + PY_MINORS="$4" +else + PY_MINORS="8 9 10 11 12" +fi -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd -P ) +REL_DIR=${SCRIPT_DIR##*/dlite/} if [ $SYSTEM = "manylinux" -a ${SYSTEM_TYPE:0:1} = "_" ]; then - template=${SCRIPT_DIR}/Dockerfile-${SYSTEM}_x_y.template + template=${REL_DIR}/Dockerfile-${SYSTEM}_x_y.template else - template=${SCRIPT_DIR}/Dockerfile-${SYSTEM}.template + template=${REL_DIR}/Dockerfile-${SYSTEM}.template fi EXTRA_PRE="" EXTRA_POST="" if [ ${SYSTEM_TYPE} == "2010" ]; then - EXTRA_PRE="COPY ${SCRIPT_DIR}/pgdg-91_${ARCH}.repo /etc/yum.repos.d/pgdg-91.repo" + EXTRA_PRE="COPY ${REL_DIR}/pgdg-91_${ARCH}.repo /etc/yum.repos.d/pgdg-91.repo" EXTRA_POST="ENV PATH=\$PATH:/usr/pgsql-9.1/bin" fi sed \ -e "s|{{ ARCH }}|${ARCH}|" \ -e "s|{{ TYPE }}|${SYSTEM_TYPE}|" \ + -e "s|{{ PY_MINORS }}|${PY_MINORS}|" \ -e "s|{{ EXTRA_PRE }}|${EXTRA_PRE}|" \ -e "s|{{ EXTRA_POST }}|${EXTRA_POST}|" \ $template diff --git a/.github/workflows/cd_docs.yml b/.github/workflows/cd_docs.yml index 8984813d5..dd6cc1d1a 100644 --- a/.github/workflows/cd_docs.yml +++ b/.github/workflows/cd_docs.yml @@ -46,7 +46,6 @@ jobs: libxml2-dev \ libxslt-dev \ libhdf5-dev \ - swig4.0 \ doxygen \ graphviz \ python3 \ @@ -56,19 +55,20 @@ jobs: python3-yaml #python3 -m pip install psycopg2-binary==2.9.5 + - name: Install Python dependencies + run: | + pip install --upgrade pip + pip install -U setuptools wheel + pip install -r requirements.txt -r requirements_doc.txt -r requirements_dev.txt + - name: Available version of installed programs run: | python --version swig -version + cmake -version doxygen --version dot -V - - name: Install Python dependencies - run: | - pip install --upgrade pip - pip install -U setuptools wheel - pip install -r requirements.txt -r requirements_doc.txt - - name: Run CMAKE run: | mkdir -p build diff --git a/.github/workflows/ci_build_wheels.yml b/.github/workflows/ci_build_wheels.yml index 9bbad55db..0fc45e6c2 100644 --- a/.github/workflows/ci_build_wheels.yml +++ b/.github/workflows/ci_build_wheels.yml @@ -17,62 +17,60 @@ jobs: fail-fast: false matrix: include: - # 32-bit linux - - os: ubuntu-20.04 - system_type: ["manylinux", "2010"] - arch: i686 - py_minors: 8,9 - # Python 3.12 often fails with segfault during shutdown for - # manylinux2014_i686 - should be debugged - - os: ubuntu-20.04 - system_type: ["manylinux", "2014"] - arch: i686 - py_minors: 8,11 - # Python 3.12 fails since cibuildwheel still depends on distutils - # for musllinux + + # 64-bit manylinux - os: ubuntu-20.04 - system_type: ["musllinux", "_1_1"] - arch: i686 - py_minors: 8,11 - # Python 3.12 fails since cibuildwheel still depends on distutils - # for musllinux + system_type: ["manylinux", "_2_34"] + arch: x86_64 + py_minors: 8,12 + #- os: ubuntu-20.04 + # system_type: ["manylinux", "_2_28"] + # arch: x86_64 + # py_minors: 8,12 + #- os: ubuntu-20.04 + # system_type: ["manylinux", "2014"] + # arch: x86_64 + # py_minors: 8,12 + #- os: ubuntu-20.04 + # system_type: ["manylinux", "2010"] + # arch: x86_64 + # py_minors: 8,9 + + # 64-bit musllinux - os: ubuntu-20.04 system_type: ["musllinux", "_1_2"] - arch: i686 + arch: x86_64 py_minors: 8,11 + # Python 3.12 fails since cibuildwheel still depends on distutils + # for musllinux + #- os: ubuntu-20.04 + # system_type: ["musllinux", "_1_1"] + # arch: x86_64 + # py_minors: 8,11 - # 64-bit linux - - os: ubuntu-20.04 - system_type: ["manylinux", "2010"] - arch: x86_64 - py_minors: 8,9 + # 32-bit manylinux - os: ubuntu-20.04 system_type: ["manylinux", "2014"] - arch: x86_64 - py_minors: 8,12 - - os: ubuntu-20.04 - system_type: ["manylinux", "_2_28"] - arch: x86_64 + arch: i686 py_minors: 8,12 - # Python 3.12 fails since cibuildwheel still depends on distutils - # for musllinux - - os: ubuntu-20.04 - system_type: ["musllinux", "_1_1"] - arch: x86_64 - py_minors: 8,11 - # Python 3.12 fails since cibuildwheel still depends on distutils - # for musllinux + # Python 3.12 fails since cibuildwheel still depends on distutils + # for musllinux + #- os: ubuntu-20.04 + # system_type: ["manylinux", "2010"] + # arch: i686 + # py_minors: 8,9 + + # 32-bit musllinux - os: ubuntu-20.04 system_type: ["musllinux", "_1_2"] - arch: x86_64 + arch: i686 py_minors: 8,11 - - # See issue #220: https://github.com/SINTEF/dlite/issues/220 - # # 32-bit Windows - # - os: windows-2019 - # system_type: ["win32", ""] - # arch: "" - # py_minors: 7,10 + # Python 3.12 fails since cibuildwheel still depends on distutils + # for musllinux + #- os: ubuntu-20.04 + # system_type: ["musllinux", "_1_1"] + # arch: i686 + # py_minors: 8,11 # 64-bit Windows - os: windows-2019 @@ -80,8 +78,15 @@ jobs: arch: amd64 py_minors: 8,12 + # 32-bit Windows + # See issue #220: https://github.com/SINTEF/dlite/issues/220 + # - os: windows-2019 + # system_type: ["win32", ""] + # arch: "" + # py_minors: 7,10 + + # 64-bit (Intel) macOS # See issue #221: https://github.com/SINTEF/dlite/issues/221 - # # 64-bit (Intel) macOS # - os: macos-10.15 # system_type: ["macosx", ""] # arch: x86_64 diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index a4d9d3f01..6a10df7a0 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -42,7 +42,6 @@ jobs: libxml2-dev \ libxslt-dev \ libhdf5-dev \ - swig4.0 \ doxygen \ graphviz \ python3 \ diff --git a/.github/workflows/container_builds_weekly.yml b/.github/workflows/container_builds_weekly.yml index 23dc892e7..4ee21e857 100644 --- a/.github/workflows/container_builds_weekly.yml +++ b/.github/workflows/container_builds_weekly.yml @@ -22,45 +22,61 @@ jobs: fail-fast: false matrix: include: - # 64-bit linux + # 64-bit manylinux - system: "manylinux" - type: "2010" - arch: "x86_64" - py_minors: "8 9" - - system: "manylinux" - type: "2014" - arch: "x86_64" - py_minors: "8 9 10 11 12" - - system: "manylinux" - type: "_2_28" + type: "_2_34" arch: "x86_64" + #py_minors: "8 9 10 11 12 13" py_minors: "8 9 10 11 12" - - system: "musllinux" - type: "_1_1" - arch: "x86_64" - py_minors: "8 9 10 11" + #- system: "manylinux" + # type: "_2_28" + # arch: "x86_64" + # py_minors: "8 9 10 11 12" + #- system: "manylinux" + # type: "2014" + # arch: "x86_64" + # py_minors: "8 9 10 11 12" + #- system: "manylinux" + # type: "2010" + # arch: "x86_64" + # py_minors: "8 9" + + # 64-bit musllinux - system: "musllinux" type: "_1_2" arch: "x86_64" + #py_minors: "8 9 10 11 12 13" py_minors: "8 9 10 11" + #- system: "musllinux" + # type: "_1_1" + # arch: "x86_64" + # py_minors: "8 9 10 11" + #- system: "musllinux" + # type: "_1_2" + # arch: "x86_64" + # py_minors: "8 9 10 11" - # 32-bit linux - - system: "manylinux" - type: "2010" - arch: "i686" - py_minors: "8 9" + # 32-bit manylinux - system: "manylinux" type: "2014" arch: "i686" + #py_minors: "8 9 10 11 12 13" py_minors: "8 9 10 11 12" - - system: "musllinux" - type: "_1_1" - arch: "i686" - py_minors: "8 9 10 11" + #- system: "manylinux" + # type: "2010" + # arch: "i686" + # py_minors: "8 9" + + # 32-bit musllinux - system: "musllinux" type: "_1_2" arch: "i686" + #py_minors: "8 9 10 11 12 13" py_minors: "8 9 10 11" + #- system: "musllinux" + # type: "_1_1" + # arch: "i686" + # py_minors: "8 9 10 11" steps: - name: Checkout repository @@ -95,7 +111,7 @@ jobs: if: env.BUILD_NEW_IMAGE == 'true' run: | mkdir -p docker_build_wheel - bash .github/docker/gen_dockerfile.sh ${{ matrix.system }} ${{ matrix.type }} ${{ matrix.arch }} \ + bash .github/docker/gen_dockerfile.sh ${{ matrix.system }} ${{ matrix.type }} ${{ matrix.arch }} "${{ matrix.py_minors }}" \ > docker_build_wheel/Dockerfile-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }} - name: Login to GitHub Container Registry diff --git a/bindings/python/dlite-misc.i b/bindings/python/dlite-misc.i index 77aa46fd5..d4d6758f3 100644 --- a/bindings/python/dlite-misc.i +++ b/bindings/python/dlite-misc.i @@ -10,18 +10,24 @@ return dlite_get_uuid(buff, id); } - status_t split_url(char *url, char **driver, char **location, + void split_meta_uri(const char *uri, char **name, char **version, + char **namespace) { + dlite_split_meta_uri(uri, name, version, namespace); + } + + void split_url(char *url, char **driver, char **location, char **options, char **fragment) { - status_t retval=0; + char *url2, *drv=NULL, *loc=NULL, *opt=NULL, *frg=NULL; - if (!(url2 = strdup(url))) return dlite_err(1, "allocation failure"); - retval = dlite_split_url(url, &drv, &loc, &opt, &frg); + if ((url2 = strdup(url))) + dlite_split_url(url2, &drv, &loc, &opt, &frg); + else + dlite_err(dliteMemoryError, "allocation failure"); if (driver) *driver = strdup((drv) ? drv : ""); if (location) *location = strdup((loc) ? loc : ""); if (options) *options = strdup((opt) ? opt : ""); if (fragment) *fragment = strdup((frg) ? frg : ""); - free(url2); - return retval; + if (url2) free(url2); } bool asbool(const char *str) { @@ -115,8 +121,8 @@ Returns (name, version, namespace)-tuplet from valid metadata `uri`. %cstring_output_allocate(char **name, if (*$1) free(*$1)); %cstring_output_allocate(char **version, if (*$1) free(*$1)); %cstring_output_allocate(char **namespace, if (*$1) free(*$1)); -status_t dlite_split_meta_uri(const char *uri, char **name, char **version, - char **namespace); +void split_meta_uri(const char *uri, char **name, char **version, + char **namespace); //int dlite_option_parse(char *options, DLiteOpt *opts, int modify); @@ -139,11 +145,12 @@ Returns a (driver, location, options, fragment)-tuplet by splitting into four parts. ") split_url; +%feature("numoutputs", "0") split_url; %cstring_output_allocate(char **driver, if (*$1) free(*$1)); %cstring_output_allocate(char **location, if (*$1) free(*$1)); %cstring_output_allocate(char **options, if (*$1) free(*$1)); %cstring_output_allocate(char **fragment, if (*$1) free(*$1)); -status_t split_url(char *url, char **driver, char **location, +void split_url(char *url, char **driver, char **location, char **options, char **fragment); diff --git a/doc/contributors_guide/tips_and_tricks.md b/doc/contributors_guide/tips_and_tricks.md index cb59a91c4..971653f14 100644 --- a/doc/contributors_guide/tips_and_tricks.md +++ b/doc/contributors_guide/tips_and_tricks.md @@ -63,7 +63,7 @@ Debugging tests failing inside docker on GitHub 3. To list all manylinux images for Python 3.12, do cd dlite # Root of DLite source directory - CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_28_x86_64:latest \ + CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_34_x86_64:latest \ CIBW_BUILD=cp312-manylinux_* \ python -m cibuildwheel \ --print-build-identifiers \ @@ -77,7 +77,7 @@ Debugging tests failing inside docker on GitHub 4. Run image. For example, to run the image `cp312-manylinux_x86_64` do - CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_28_x86_64:latest \ + CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_34_x86_64:latest \ CIBW_BUILD=cp312-manylinux_x86* \ python -m cibuildwheel \ --output-dir wheelhouse \ @@ -92,7 +92,7 @@ Debugging tests failing inside docker on GitHub the previous command: CIBW_BEFORE_TEST=cat \ - CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_28_x86_64:latest \ + CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_34_x86_64:latest \ CIBW_BUILD=cp312-manylinux_x86* \ python -m cibuildwheel \ --output-dir wheelhouse \ @@ -127,7 +127,7 @@ Debugging tests failing inside docker on GitHub ls /tmp/cibuildwheel/repaired_wheel/DLite_Python-*.whl - pip install /tmp/cibuildwheel/repaired_wheel/DLite_Python-0.3.18-cp312-cp312m-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl + pip install /tmp/cibuildwheel/repaired_wheel/DLite_Python-*.whl 8. Now we can run the Python tests with @@ -146,7 +146,7 @@ and get its IP with You can then rerun `cibuildwheel` with the CIBW_BUILD_FRONTEND="pip; args: --index-url http://$ip:3141/root/pypi/" \ - CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_28_x86_64:latest \ + CIBW_MANYLINUX_X86_64_IMAGE=ghcr.io/sintef/dlite-python-manylinux_2_34_x86_64:latest \ CIBW_BUILD=cp312-manylinux_x86* \ python -m cibuildwheel \ --output-dir wheelhouse \ diff --git a/doc/getting_started/installation.md b/doc/getting_started/installation.md index 91e339a43..6bce1f04f 100644 --- a/doc/getting_started/installation.md +++ b/doc/getting_started/installation.md @@ -30,30 +30,16 @@ The complete list of extra requirements is as follows: ### Supported binary releases DLite uses [cibuildwheel] for providing binary releases for Linux and Windows on various platforms and versions of Python. The provided -wheels are shown in the following two tables. +wheels are shown in the following table. -#### 32-bit - -| Python version | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | -| ---------------- | --- | --- | ---- | ---- | ---- | -| [musllinux_1_1] | x | x | x | x | | -| [musllinux_1_2] | x | x | x | x | | -| [manylinux2010] | x | x | | | | -| [manylinux2014] | x | x | x | x | | -| [manylinux_2_28] | | | | | | -| windows | | | | | | - -#### 64-bit - -| Python version | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | -| ---------------- | --- | --- | ---- | ---- | ---- | -| [musllinux_1_1] | x | x | x | x | | -| [musllinux_1_2] | x | x | x | x | | -| [manylinux2010] | x | x | | | | -| [manylinux2014] | x | x | x | x | x | -| [manylinux_2_28] | x | x | x | x | x | -| windows | x | x | x | x | x | +| Platform | Arch | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | +|------------------|--------|-----|-----|------|------|------| +| [manylinux_2_34] | x86_64 | x | x | x | x | x | +| [manylinux2014] | i686 | x | x | x | x | x | +| [musllinux_1_2] | x86_64 | x | x | x | x | | +| [musllinux_1_2] | i686 | x | x | x | x | | +| windows | x86_64 | x | x | x | x | x | Development installation @@ -80,8 +66,6 @@ pip install DLite-Python[doc] [runtime dependencies]: https://sintef.github.io/dlite/getting_started/build/runtime_dependencies.html [build from source]: https://sintef.github.io/dlite/getting_started/build/build.html [cibuildwheel]: https://github.com/pypa/cibuildwheel -[musllinux_1_1]: https://peps.python.org/pep-0656/ -[musllinux_1_2]: https://peps.python.org/pep-0656/ -[manylinux2010]: https://github.com/pypa/manylinux?tab=readme-ov-file#manylinux2014-centos-7-based [manylinux2014]: https://github.com/pypa/manylinux?tab=readme-ov-file#manylinux2014-centos-7-based -[manylinux_2_28]: https://github.com/pypa/manylinux?tab=readme-ov-file#manylinux_2_28-almalinux-8-based +[manylinux_2_34]: https://github.com/pypa/manylinux?tab=readme-ov-file#manylinux_2_34-almalinux-9-base +[musllinux_1_2]: https://peps.python.org/pep-0656/ diff --git a/python/setup.py b/python/setup.py index 91e04c267..fcc0dcab6 100644 --- a/python/setup.py +++ b/python/setup.py @@ -20,7 +20,7 @@ # Based on # https://github.com/galois-advertising/cmake_setup/blob/master/cmake_setup/cmake/__init__.py -SETUP_DIR = Path(__file__).parent.resolve() +SETUP_DIR = Path(__file__).resolve().parent SOURCE_DIR = SETUP_DIR.parent if platform.system() == "Linux": @@ -67,6 +67,14 @@ raise NotImplementedError(f"Unsupported platform: {platform.system()}") +requirements = [ + line.strip() for line in open(SOURCE_DIR/"requirements.txt", "rt") +] +requirements_dev = [ + line.strip() for line in open(SOURCE_DIR/"requirements_dev.txt", "rt") +] + + class CMakeExtension(Extension): """ setuptools.Extension for cmake @@ -209,8 +217,8 @@ def run(self): "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries :: Python Modules", ], - install_requires="numpy>=1.14.5,<1.27.0", - #install_requires=requirements, + build_requires=requirements_dev, + install_requires=requirements, #extras_require=extra_requirements, packages=["DLite-Python"], scripts=[ diff --git a/requirements_dev.txt b/requirements_dev.txt index 7c3f4051b..6ac8a04ba 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,6 @@ # Requirements building -cmake>=1.21.6 +swig==4.1.1 +cmake==3.31.1 # Requirements for running tests mongomock>=4.1.2,<5 diff --git a/requirements_full.txt b/requirements_full.txt index f05ca3bba..e34db4b04 100644 --- a/requirements_full.txt +++ b/requirements_full.txt @@ -22,7 +22,7 @@ pymongo>=4.4.0,<5 # Utilities pydantic>=1.10.0,<2.9.3 -typing_extensions>=4.1,<5 +typing_extensions>=4.1,<5; python_version<'3.9' fortran-language-server>=1.12.0,<1.13 # For TEM demo diff --git a/src/config-paths.h.in b/src/config-paths.h.in index 28f9ee936..33e9237ab 100644 --- a/src/config-paths.h.in +++ b/src/config-paths.h.in @@ -25,9 +25,17 @@ /* dlite-pyembed.c does not imports config.h to avoid conflicts with Python .h Include configurations needed by dlite-pyembed.c here */ +#ifndef HAVE_SETENV #cmakedefine HAVE_SETENV +#endif + +#ifndef HAVE__PUTENV_S #cmakedefine HAVE__PUTENV_S +#endif + +#ifndef HAVE_UNSETENV #cmakedefine HAVE_UNSETENV +#endif