Skip to content

Commit ab99772

Browse files
committed
CI/Builds: various updates
- Try installing the resulting wheel on all platforms, and importing `_fastdss`. - Allow building with any NumPy 2.x. - Allow Linux x86 to run the import test. - Testing tweaks to macOS builds. - Add missing LICENSE.LGPL3 - Migrate from calling setup.py directly to `python -m build`; somewhat supports build isolation. - Fixing macOS rpath Windows x86/32-bit is temporarily disabled since the wheel is failing.
1 parent e3faceb commit ab99772

10 files changed

Lines changed: 219 additions & 16 deletions

File tree

.github/workflows/builds.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Builds
33
# TODO: generalize steps
44

55
env:
6-
DSS_CAPI_TAG: '0.15.0b1'
6+
DSS_CAPI_TAG: '0.15.0b2'
77
ARTIFACTS_FOLDER: '${{ github.workspace }}/artifacts'
88

99
on:
@@ -33,7 +33,7 @@ jobs:
3333
conda_subdir: 'linux-64'
3434

3535
- arch: x86
36-
docker_image: 'pmeira/manylinux_wheel_fpc322_i686'
36+
docker_image: 'quay.io/pypa/manylinux_2_34_i686'
3737
dss_extensions_linux32: linux32
3838
gh_image: ubuntu-latest
3939
manylinux-base: 'manylinux2014'
@@ -89,7 +89,7 @@ jobs:
8989
name: 'packages-linux_${{ matrix.arch }}-${{ matrix.manylinux-base }}'
9090
path: '${{ github.workspace }}/artifacts'
9191
- name: Try installing the wheel
92-
if: ${{ matrix.arch != 'x86' }}
92+
continue-on-error: ${{ matrix.arch == 'x86' }}
9393
run: |
9494
docker run -e GITHUB_SHA -e GITHUB_REF -e DSS_CAPI_PATH=/build/dss_capi -v "${PWD}:/build" -w /build $DOCKER_IMAGE ${{ matrix.dss_extensions_linux32}} bash /build/dss_python_backend/ci/test_wheel.sh
9595
@@ -101,6 +101,7 @@ jobs:
101101
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
102102
#SDKROOT: '${{ github.workspace }}/MacOSX10.13.sdk'
103103
PYTHON: python
104+
MACOSX_DEPLOYMENT_TARGET: "11.0"
104105
steps:
105106
- uses: actions/checkout@v3
106107
with:
@@ -137,18 +138,25 @@ jobs:
137138
with:
138139
name: 'packages-darwin_x64'
139140
path: '${{ github.workspace }}/artifacts'
141+
- name: Try installing the wheel
142+
continue-on-error: true
143+
shell: bash
144+
run: |
145+
python -m pip install artifacts/dss_python_backend-*.whl
146+
python -c 'from dss_python_backend import lib, ffi; lib.DSS_NewCircuit(ffi.NULL, b"test123"); assert ffi.string(lib.Circuit_Get_Name(ffi.NULL)) == b"test123"'
147+
python -c 'from dss_python_backend import _fastdss'
140148
141149
build_macos_arm64:
142150
name: 'macOS ARM64'
143151
continue-on-error: false
144-
runs-on: 'macos-latest'
152+
runs-on: 'macos-15'
145153
env:
146154
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
147155
# SDKROOT: '${{ github.workspace }}/MacOSX10.13.sdk'
148156
PYTHON: python
149157
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
150158
ARCHFLAGS: '-arch arm64'
151-
159+
MACOSX_DEPLOYMENT_TARGET: "11.0"
152160
steps:
153161
- uses: actions/checkout@v3
154162
with:
@@ -185,6 +193,13 @@ jobs:
185193
with:
186194
name: 'packages-darwin_arm64'
187195
path: '${{ github.workspace }}/artifacts'
196+
- name: Try installing the wheel
197+
continue-on-error: true
198+
shell: bash
199+
run: |
200+
python -m pip install artifacts/dss_python_backend-*.whl
201+
python -c 'from dss_python_backend import lib, ffi; lib.DSS_NewCircuit(ffi.NULL, b"test123"); assert ffi.string(lib.Circuit_Get_Name(ffi.NULL)) == b"test123"'
202+
python -c 'from dss_python_backend import _fastdss'
188203
189204
build_win_x64:
190205
name: 'Windows x64'
@@ -219,9 +234,18 @@ jobs:
219234
with:
220235
name: 'packages-win_x64'
221236
path: '${{ github.workspace }}/artifacts'
237+
- name: Try installing the wheel
238+
continue-on-error: true
239+
shell: bash
240+
run: |
241+
python -m pip install artifacts/dss_python_backend-*.whl
242+
python -c "from dss_python_backend import lib, ffi; lib.DSS_NewCircuit(ffi.NULL, b'test123'); assert ffi.string(lib.Circuit_Get_Name(ffi.NULL)) == b'test123'"
243+
python -c "from dss_python_backend import _fastdss"
244+
222245
223246
build_win_x86:
224247
name: 'Windows x86'
248+
if: false
225249
continue-on-error: false
226250
runs-on: windows-2022
227251
env:
@@ -254,6 +278,13 @@ jobs:
254278
with:
255279
name: 'packages-win_x86'
256280
path: '${{ github.workspace }}/artifacts'
281+
- name: Try installing the wheel
282+
continue-on-error: true
283+
shell: bash
284+
run: |
285+
python -m pip install artifacts/dss_python_backend-*.whl
286+
python -c "from dss_python_backend import lib, ffi; lib.DSS_NewCircuit(ffi.NULL, b'test123'); assert ffi.string(lib.Circuit_Get_Name(ffi.NULL)) == b'test123'"
287+
python -c "from dss_python_backend import _fastdss"
257288
258289
merge:
259290
name: 'Merge build artifacts'

LICENSE.LGPL3

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5+
Everyone is permitted to copy and distribute verbatim copies
6+
of this license document, but changing it is not allowed.
7+
8+
9+
This version of the GNU Lesser General Public License incorporates
10+
the terms and conditions of version 3 of the GNU General Public
11+
License, supplemented by the additional permissions listed below.
12+
13+
0. Additional Definitions.
14+
15+
As used herein, "this License" refers to version 3 of the GNU Lesser
16+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17+
General Public License.
18+
19+
"The Library" refers to a covered work governed by this License,
20+
other than an Application or a Combined Work as defined below.
21+
22+
An "Application" is any work that makes use of an interface provided
23+
by the Library, but which is not otherwise based on the Library.
24+
Defining a subclass of a class defined by the Library is deemed a mode
25+
of using an interface provided by the Library.
26+
27+
A "Combined Work" is a work produced by combining or linking an
28+
Application with the Library. The particular version of the Library
29+
with which the Combined Work was made is also called the "Linked
30+
Version".
31+
32+
The "Minimal Corresponding Source" for a Combined Work means the
33+
Corresponding Source for the Combined Work, excluding any source code
34+
for portions of the Combined Work that, considered in isolation, are
35+
based on the Application, and not on the Linked Version.
36+
37+
The "Corresponding Application Code" for a Combined Work means the
38+
object code and/or source code for the Application, including any data
39+
and utility programs needed for reproducing the Combined Work from the
40+
Application, but excluding the System Libraries of the Combined Work.
41+
42+
1. Exception to Section 3 of the GNU GPL.
43+
44+
You may convey a covered work under sections 3 and 4 of this License
45+
without being bound by section 3 of the GNU GPL.
46+
47+
2. Conveying Modified Versions.
48+
49+
If you modify a copy of the Library, and, in your modifications, a
50+
facility refers to a function or data to be supplied by an Application
51+
that uses the facility (other than as an argument passed when the
52+
facility is invoked), then you may convey a copy of the modified
53+
version:
54+
55+
a) under this License, provided that you make a good faith effort to
56+
ensure that, in the event an Application does not supply the
57+
function or data, the facility still operates, and performs
58+
whatever part of its purpose remains meaningful, or
59+
60+
b) under the GNU GPL, with none of the additional permissions of
61+
this License applicable to that copy.
62+
63+
3. Object Code Incorporating Material from Library Header Files.
64+
65+
The object code form of an Application may incorporate material from
66+
a header file that is part of the Library. You may convey such object
67+
code under terms of your choice, provided that, if the incorporated
68+
material is not limited to numerical parameters, data structure
69+
layouts and accessors, or small macros, inline functions and templates
70+
(ten or fewer lines in length), you do both of the following:
71+
72+
a) Give prominent notice with each copy of the object code that the
73+
Library is used in it and that the Library and its use are
74+
covered by this License.
75+
76+
b) Accompany the object code with a copy of the GNU GPL and this license
77+
document.
78+
79+
4. Combined Works.
80+
81+
You may convey a Combined Work under terms of your choice that,
82+
taken together, effectively do not restrict modification of the
83+
portions of the Library contained in the Combined Work and reverse
84+
engineering for debugging such modifications, if you also do each of
85+
the following:
86+
87+
a) Give prominent notice with each copy of the Combined Work that
88+
the Library is used in it and that the Library and its use are
89+
covered by this License.
90+
91+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
92+
document.
93+
94+
c) For a Combined Work that displays copyright notices during
95+
execution, include the copyright notice for the Library among
96+
these notices, as well as a reference directing the user to the
97+
copies of the GNU GPL and this license document.
98+
99+
d) Do one of the following:
100+
101+
0) Convey the Minimal Corresponding Source under the terms of this
102+
License, and the Corresponding Application Code in a form
103+
suitable for, and under terms that permit, the user to
104+
recombine or relink the Application with a modified version of
105+
the Linked Version to produce a modified Combined Work, in the
106+
manner specified by section 6 of the GNU GPL for conveying
107+
Corresponding Source.
108+
109+
1) Use a suitable shared library mechanism for linking with the
110+
Library. A suitable mechanism is one that (a) uses at run time
111+
a copy of the Library already present on the user's computer
112+
system, and (b) will operate properly with a modified version
113+
of the Library that is interface-compatible with the Linked
114+
Version.
115+
116+
e) Provide Installation Information, but only if you would otherwise
117+
be required to provide such information under section 6 of the
118+
GNU GPL, and only to the extent that such information is
119+
necessary to install and execute a modified version of the
120+
Combined Work produced by recombining or relinking the
121+
Application with a modified version of the Linked Version. (If
122+
you use option 4d0, the Installation Information must accompany
123+
the Minimal Corresponding Source and Corresponding Application
124+
Code. If you use option 4d1, you must provide the Installation
125+
Information in the manner specified by section 6 of the GNU GPL
126+
for conveying Corresponding Source.)
127+
128+
5. Combined Libraries.
129+
130+
You may place library facilities that are a work based on the
131+
Library side by side in a single library together with other library
132+
facilities that are not Applications and are not covered by this
133+
License, and convey such a combined library under terms of your
134+
choice, if you do both of the following:
135+
136+
a) Accompany the combined library with a copy of the same work based
137+
on the Library, uncombined with any other library facilities,
138+
conveyed under the terms of this License.
139+
140+
b) Give prominent notice with the combined library that part of it
141+
is a work based on the Library, and explaining where to find the
142+
accompanying uncombined form of the same work.
143+
144+
6. Revised Versions of the GNU Lesser General Public License.
145+
146+
The Free Software Foundation may publish revised and/or new versions
147+
of the GNU Lesser General Public License from time to time. Such new
148+
versions will be similar in spirit to the present version, but may
149+
differ in detail to address new problems or concerns.
150+
151+
Each version is given a distinguishing version number. If the
152+
Library as you received it specifies that a certain numbered version
153+
of the GNU Lesser General Public License "or any later version"
154+
applies to it, you have the option of following the terms and
155+
conditions either of that published version or of any later version
156+
published by the Free Software Foundation. If the Library as you
157+
received it does not specify a version number of the GNU Lesser
158+
General Public License, you may choose any version of the GNU Lesser
159+
General Public License ever published by the Free Software Foundation.
160+
161+
If the Library as you received it specifies that a proxy can decide
162+
whether future versions of the GNU Lesser General Public License shall
163+
apply, that proxy's public statement of acceptance of any version is
164+
permanent authorization for you to choose that version for the
165+
Library.

ci/build_linux.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ export PATH=/opt/python/cp311-cp311/bin/:$PATH
33
# export DSS_PYTHON_BACKEND_MANYLINUX=1
44

55
cd dss_python_backend
6-
python3 -m pip install --user --upgrade pip setuptools packaging trove-classifiers cffi wheel numpy==2
7-
python3 setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir="../artifacts_raw"
6+
python3 -m pip install --user --upgrade pip setuptools packaging trove-classifiers cffi wheel 'numpy>=2,<3' build
7+
# python3 setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir="../artifacts_raw"
8+
python3 -m build --wheel --outdir="../artifacts_raw"
89
cd ..
910

1011
# Bundle external shared libraries into the wheels

ci/build_wheel.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mkdir -p artifacts
22
cd dss_python_backend
3-
$PYTHON -m pip install --upgrade pip setuptools packaging trove-classifiers cffi wheel numpy==2
4-
$PYTHON setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir=$ARTIFACTS_FOLDER
3+
$PYTHON -m pip install --upgrade pip setuptools packaging trove-classifiers cffi wheel 'numpy>=2,<3' build
4+
# $PYTHON setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir=$ARTIFACTS_FOLDER
5+
$PYTHON -m build --wheel --outdir="$ARTIFACTS_FOLDER"

ci/test_wheel.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
set -e -x
44

55
ORIGINAL_PATH=$PATH
6-
PYTHON_DIRS="cp311-cp311 cp312-cp312"
6+
PYTHON_DIRS="cp312-cp312 cp313-cp313 cp314-cp314"
77

88
for pydir in $PYTHON_DIRS
99
do
1010
echo Installing for CPython $pydir
1111
export PATH=/opt/python/${pydir}/bin/:$ORIGINAL_PATH
1212
python -m pip install artifacts/dss_python_backend-*.whl
1313
python -c 'from dss_python_backend import lib, ffi; lib.DSS_NewCircuit(ffi.NULL, b"test123"); assert ffi.string(lib.Circuit_Get_Name(ffi.NULL)) == b"test123"'
14+
python -c 'from dss_python_backend import _fastdss'
1415
done

dss_build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def process_header(src, extern_py=False, implement_py=False, prefix='', flags=No
128128
# Due to some specifics on Windows, we need to skip the lib included via pragma
129129
python3xx_lib = f"python{sys.version_info.major}{sys.version_info.minor}.lib"
130130
extra['extra_link_args'] = [f"/NODEFAULTLIB:{python3xx_lib}"]
131+
elif sys.platform == 'darwin':
132+
extra['extra_link_args'] = ["-Wl,-rpath,@loader_path/."]
133+
131134

132135
ffi_builders = {}
133136

dss_python_backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@
5656
# CffiApiUtil so we call it as soon as the DLL/so is loaded.
5757
lib.DSS_Start(ffi.NULL, 0)
5858

59-
__version__ = '0.15.0b1'
59+
__version__ = '0.15.0b2'
6060
__all__ = ['ffi', 'lib', 'loader_lib']

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ Repository = "https://github.com/dss-extensions/dss_python_backend.git"
3838
"Bug Tracker" = "https://github.com/dss-extensions/dss-extensions/issues"
3939

4040
[build-system]
41-
requires = ["setuptools"]
41+
requires = ["setuptools", "numpy>=2,<3", "cffi"]
4242
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[metadata]
22
description_file = README.md
3-
license_files = LICENSE
43
url = https://github.com/dss-extensions/dss_python_backend/
54

65
[bdist_wheel]

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from setuptools import setup
2-
import re, shutil, os, io
2+
import re, shutil, os, io, sys, glob
3+
4+
sys.path.insert(0, os.path.dirname(__file__))
5+
36
from dss_setup_common import PLATFORM_FOLDER, DLL_SUFFIX
4-
import glob
57
import dss_build
68

79
SKIP_COPY = os.environ.get('DSS_PYTHON_BACKEND_SKIP_COPY', '0') == '1'
@@ -81,7 +83,7 @@
8183

8284
setup(
8385
version=package_version,
84-
packages=['dss_python_backend'],
86+
packages=['dss_python_backend', 'dss_python_backend.include'],
8587
setup_requires=["cffi>=2.0.0"],
8688
cffi_modules= [
8789
"dss_build.py:ffi_builder_dss",

0 commit comments

Comments
 (0)