Skip to content

Commit

Permalink
Python 3.11, 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
hombit committed Apr 11, 2024
1 parent 1ffb129 commit 738d407
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ jobs:
- name: Build container with wheels
run: docker build -f Dockerfile.python -t freddi:python .
- name: Build containers
run: for V in 3.7 3.8 3.9 3.10; do docker build -f .ci/Dockerfile-test-wheels --build-arg PY_VERSION=$V -t freddi:python$V .; done
run: for V in 3.7 3.8 3.9 3.10 3.11 3.12; do docker build -f .ci/Dockerfile-test-wheels --build-arg PY_VERSION=$V -t freddi:python$V .; done
- name: Run sample Python script
run: for V in 3.7 3.8 3.9 3.10; do docker run --rm -t freddi:python$V python -c "import freddi; freddi.Freddi(**freddi._freddi._Freddi._required_args())"; done
run: for V in 3.7 3.8 3.9 3.10 3.11 3.12 ; do docker run --rm -t freddi:python$V python -c "import freddi; freddi.Freddi(**freddi._freddi._Freddi._required_args())"; done
42 changes: 23 additions & 19 deletions Dockerfile.python
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ FROM quay.io/pypa/manylinux2014_aarch64 AS base_arm64

FROM base_$TARGETARCH

RUN python3.7 -mpip install -U pip && python3.7 -mpip install -U numpy wheel setuptools cmake ninja scikit-build \
&& python3.8 -mpip install -U pip && python3.8 -mpip install -U numpy wheel setuptools cmake ninja scikit-build \
&& python3.9 -mpip install -U pip && python3.9 -mpip install -U numpy wheel setuptools cmake ninja scikit-build \
&& python3.10 -mpip install -U pip && python3.10 -mpip install -U numpy wheel setuptools cmake ninja scikit-build
# Install numpy for Boost
RUN python3.7 -mpip install -U numpy \
&& python3.8 -mpip install -U numpy \
&& python3.9 -mpip install -U numpy \
&& python3.10 -mpip install -U numpy \
&& python3.11 -mpip install -U numpy \
&& python3.12 -mpip install -U numpy

ENV BOOST_VERSION "1.78.0"
ENV BOOST_VERSION_ "1_78_0"
ENV BOOST_VERSION "1.84.0"
ENV BOOST_VERSION_ "1_84_0"

RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_}.tar.gz \
&& tar -xzf boost_${BOOST_VERSION_}.tar.gz \
Expand All @@ -23,29 +26,30 @@ RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}
&& echo "using python : 3.8 : /opt/python/cp38-cp38/bin/python : /opt/python/cp38-cp38/include/python3.8 : /opt/python/cp38-cp38/lib ;" >> tools/build/src/user-config.jam \
&& echo "using python : 3.9 : /opt/python/cp39-cp39/bin/python : /opt/python/cp39-cp39/include/python3.9 : /opt/python/cp39-cp39/lib ;" >> tools/build/src/user-config.jam \
&& echo "using python : 3.10 : /opt/python/cp310-cp310/bin/python : /opt/python/cp310-cp310/include/python3.10 : /opt/python/cp310-cp310/lib ;" >> tools/build/src/user-config.jam \
&& ./b2 -d+2 python=3.7,3.8,3.9,3.10 link=static cflags="-fPIC" cxxflags="-fPIC" install \
&& echo "using python : 3.11 : /opt/python/cp311-cp311/bin/python : /opt/python/cp311-cp311/include/python3.11 : /opt/python/cp311-cp311/lib ;" >> tools/build/src/user-config.jam \
&& echo "using python : 3.12 : /opt/python/cp312-cp312/bin/python : /opt/python/cp312-cp312/include/python3.12 : /opt/python/cp312-cp312/lib ;" >> tools/build/src/user-config.jam \
&& ./b2 -d+2 python=3.7,3.8,3.9,3.10,3.11,3.12 link=static cflags="-fPIC" cxxflags="-fPIC" install \
&& cd / \
&& rm -rf /boost_${BOOST_VERSION_}

RUN python3.7 -m pip install -U auditwheel twine
RUN python3.12 -m pip install -U auditwheel twine

ENV SOURCE "/tmp/source"
ENV BUILD "/tmp/build"
ENV DIST "/dist"

ENV SKBUILD_CONFIGURE_OPTIONS="-DSTATIC_LINKING=TRUE"

COPY CMakeLists.txt freddi.ini pyproject.toml setup.py MANIFEST.in Readme.md ${SOURCE}/
COPY cpp ${SOURCE}/cpp
COPY python ${SOURCE}/python

WORKDIR ${SOURCE}
RUN python3.7 setup.py sdist -d${DIST}
RUN NCPUS=$(grep -c ^processor /proc/cpuinfo) \
&& python3.7 setup.py bdist_wheel -DSTATIC_LINKING=TRUE -d${BUILD} -- -- -j$NCPUS \
&& rm -r _skbuild \
&& python3.8 setup.py bdist_wheel -DSTATIC_LINKING=TRUE -d${BUILD} -- -- -j$NCPUS \
&& rm -r _skbuild \
&& python3.9 setup.py bdist_wheel -DSTATIC_LINKING=TRUE -d${BUILD} -- -- -j$NCPUS \
&& rm -r _skbuild \
&& python3.10 setup.py bdist_wheel -DSTATIC_LINKING=TRUE -d${BUILD} -- -- -j$NCPUS \
&& rm -r _skbuild
RUN ls ${BUILD}/*.whl | xargs -iZZZ python3.7 -m auditwheel repair --wheel-dir=${DIST} ZZZ
RUN python3.12 -mbuild -o${DIST}
RUN python3.7 -mbuild -o${DIST} \
&& python3.8 -mbuild -o${DIST} \
&& python3.9 -mbuild -o${DIST} \
&& python3.10 -mbuild -o${DIST} \
&& python3.12 -mbuild -o${DIST}

RUN ls ${BUILD}/*.whl | xargs -iZZZ python3.12 -m auditwheel repair --wheel-dir=${DIST} ZZZ
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Physics',
],
Expand Down

0 comments on commit 738d407

Please sign in to comment.