Skip to content

Commit 02cb98d

Browse files
[Python] Bundle FESAPI DLL import library into Windows wheel
Windows wheel CI: copy generated .lib files from fesapi-install/lib into the Release build folder so they are available during wheel repair. Update the CIBW_REPAIR_WHEEL_COMMAND_WINDOWS to include --include-imports for delvewheel (keeping --namespace-pkg) so imported DLLs are bundled into the repaired wheel.
1 parent 68701a9 commit 02cb98d

2 files changed

Lines changed: 30 additions & 27 deletions

File tree

.github/workflows/github-actions.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,18 @@ jobs:
144144
env:
145145
CIBW_BUILD: cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64 cp313-win_amd64
146146
CIBW_ARCHS: auto64
147-
CIBW_BEFORE_ALL: >
147+
CIBW_BEFORE_ALL_WINDOWS: >
148148
%VCPKG_INSTALLATION_ROOT%\vcpkg install boost-uuid minizip hdf5[zlib] &&
149-
cd ${{ runner.temp }} &&
149+
cd %RUNNER_TEMP% &&
150150
mkdir fesapi-build &&
151151
cd fesapi-build &&
152-
cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install ${{ github.workspace }} &&
152+
cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX=%RUNNER_TEMP%/fesapi-install ${{ github.workspace }} &&
153153
cmake --build . --config Release -j2 &&
154154
cmake --build . --config Release --target INSTALL &&
155+
copy "%RUNNER_TEMP%/fesapi-install/lib/*.lib" "%RUNNER_TEMP%/fesapi-build/Release" &&
155156
pip install delvewheel
156157
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
157-
delvewheel repair --add-path ${{ runner.temp }}\fesapi-build\Release --namespace-pkg fesapi -w {dest_dir} {wheel}
158+
delvewheel repair --add-path %RUNNER_TEMP%\fesapi-build\Release --include-imports --namespace-pkg fesapi -w {dest_dir} {wheel}
158159
CIBW_TEST_COMMAND: python ${{github.workspace}}\python\example\example.py
159160
with:
160161
package-dir: ./python

python/example/fesapi.ipynb

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "40a17e1f-53f0-4ec9-b2a4-2718acf2a59e",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"The very first step is to download and install the FESAPI wheel : pip install fesapi"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "a16222c5-064e-431d-9dae-d3d6c535a6b9",
13+
"id": "1",
1414
"metadata": {},
1515
"source": [
1616
"Once FESAPI wheel installed, you need to first import it in order to be able to call its API (https://www.f2i-consulting.com/fesapi/doxygen/)"
1717
]
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 1,
22-
"id": "fe2772db-0f12-4ba3-bd7c-17890092dc63",
21+
"execution_count": null,
22+
"id": "2",
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
@@ -28,16 +28,16 @@
2828
},
2929
{
3030
"cell_type": "markdown",
31-
"id": "0e0f0067-7c3e-4b4f-9da9-b6a4da7f8929",
31+
"id": "3",
3232
"metadata": {},
3333
"source": [
3434
"Let's now create a DataObjectRepository in order to store Energistics dataobjects in-memory."
3535
]
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 2,
40-
"id": "6d5cda5b-7627-4405-a4c0-ced8edbe9257",
39+
"execution_count": null,
40+
"id": "4",
4141
"metadata": {},
4242
"outputs": [],
4343
"source": [
@@ -46,16 +46,16 @@
4646
},
4747
{
4848
"cell_type": "markdown",
49-
"id": "d7d5c21e-8b14-4bd6-a78f-d0bef5014e4f",
49+
"id": "5",
5050
"metadata": {},
5151
"source": [
5252
"Energistics local CRS and Energistics HDF Proxy dataobjects are respectively required when we want to export CRS aware dataobjects and RESQML2 representations. Let's create them and set them as default ones for all other Energistics dataobject we will create later."
5353
]
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 3,
58-
"id": "5c3e7a41-5270-4a06-9125-af784c097f17",
57+
"execution_count": null,
58+
"id": "6",
5959
"metadata": {},
6060
"outputs": [],
6161
"source": [
@@ -76,16 +76,16 @@
7676
},
7777
{
7878
"cell_type": "markdown",
79-
"id": "dcfbaeab-a787-47ff-b323-437bb3b556df",
79+
"id": "7",
8080
"metadata": {},
8181
"source": [
8282
"We can now create plenty of Energistics dataobjects. Let's try a Horizon 2d grid."
8383
]
8484
},
8585
{
8686
"cell_type": "code",
87-
"execution_count": 4,
88-
"id": "a987ec54-86a8-424f-9539-48b87a9e8dea",
87+
"execution_count": null,
88+
"id": "8",
8989
"metadata": {},
9090
"outputs": [],
9191
"source": [
@@ -96,7 +96,7 @@
9696
},
9797
{
9898
"cell_type": "markdown",
99-
"id": "b564949a-03b8-4988-b4d8-c779b2f3fe2a",
99+
"id": "9",
100100
"metadata": {},
101101
"source": [
102102
"And let's set a 2x3 geometry on this 2d grid where the Z values equal hundred times the node index.\n",
@@ -108,8 +108,8 @@
108108
},
109109
{
110110
"cell_type": "code",
111-
"execution_count": 5,
112-
"id": "c6245f4b-5acd-454b-921d-99e767c36c79",
111+
"execution_count": null,
112+
"id": "10",
113113
"metadata": {},
114114
"outputs": [],
115115
"source": [
@@ -124,25 +124,27 @@
124124
},
125125
{
126126
"cell_type": "markdown",
127-
"id": "0580e85e-0040-423c-8825-ebfb511ba26f",
127+
"id": "11",
128128
"metadata": {},
129129
"source": [
130130
"We can now serialize our DataObjectRepository into an EPC document in order to share it with other EPC aware application."
131131
]
132132
},
133133
{
134134
"cell_type": "code",
135-
"id": "b5d289e6-c699-4d88-a870-3dae2baf14ee",
135+
"execution_count": null,
136+
"id": "12",
136137
"metadata": {},
138+
"outputs": [],
137139
"source": [
138-
"# Create an EPC Document in the current folder nad named TestingFesapiWithPython.epc\n",
140+
"# Create an EPC Document named TestingFesapiWithPython.epc in the current folder\n",
139141
"epc_file = fesapi.EpcDocument(file_name_without_extension + \".epc\")\n",
140142
"epc_file.serializeFrom(repo)"
141143
]
142144
},
143145
{
144146
"cell_type": "markdown",
145-
"id": "6614030b",
147+
"id": "13",
146148
"metadata": {},
147149
"source": [
148150
"We can clear the repository to clean in memory repository and release HDF5 files."
@@ -151,7 +153,7 @@
151153
{
152154
"cell_type": "code",
153155
"execution_count": null,
154-
"id": "df354cf5",
156+
"id": "14",
155157
"metadata": {},
156158
"outputs": [],
157159
"source": [
@@ -161,7 +163,7 @@
161163
],
162164
"metadata": {
163165
"kernelspec": {
164-
"display_name": ".venv (3.11.9)",
166+
"display_name": "Python 3",
165167
"language": "python",
166168
"name": "python3"
167169
},
@@ -175,7 +177,7 @@
175177
"name": "python",
176178
"nbconvert_exporter": "python",
177179
"pygments_lexer": "ipython3",
178-
"version": "3.11.9"
180+
"version": "3.8"
179181
}
180182
},
181183
"nbformat": 4,

0 commit comments

Comments
 (0)