pyi2em 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ name: tests
2
+ on:
3
+ push:
4
+ branches: [ master ]
5
+ pull_request:
6
+ branches: [ master ]
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ test:
11
+ name: pytest (${{ matrix.os }}, py${{ matrix.python-version }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest]
17
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: System deps (Linux)
24
+ if: runner.os == 'Linux'
25
+ run: sudo apt-get update && sudo apt-get install -y libgsl-dev cmake build-essential
26
+ - name: System deps (macOS)
27
+ if: runner.os == 'macOS'
28
+ run: brew update && brew install gsl cmake
29
+ - name: Install Python deps
30
+ run: |
31
+ python -m pip install -U pip
32
+ python -m pip install numpy pytest build
33
+ - name: Build and install package
34
+ run: |
35
+ python -m pip install .
36
+ - name: Run tests
37
+ run: pytest -q
@@ -0,0 +1,108 @@
1
+ name: build-wheels
2
+ on:
3
+ push: { tags: ["v*"] }
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+ id-token: write
9
+
10
+ jobs:
11
+ build:
12
+ strategy:
13
+ matrix:
14
+ include:
15
+ - os: ubuntu-latest
16
+ - os: macos-13
17
+ macos_arch: x86_64
18
+ macos_target: "13.0"
19
+ - os: macos-14
20
+ macos_arch: arm64
21
+ macos_target: "14.0"
22
+ runs-on: ${{ matrix.os }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: actions/setup-python@v5
26
+ with: { python-version: "3.12" }
27
+ - run: python -m pip install -U pip cibuildwheel build
28
+ # On Linux, cibuildwheel builds inside a manylinux container; install GSL inside
29
+ # the container using CIBW_BEFORE_ALL_LINUX and export PKG_CONFIG_PATH so CMake
30
+ # can find it via pkg-config. auditwheel will bundle libgsl into the wheel.
31
+ - name: System deps (macOS)
32
+ if: runner.os == 'macOS'
33
+ run: brew update && brew install gsl pkg-config
34
+ - name: Build wheels
35
+ env:
36
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
37
+ CIBW_SKIP: "*-musllinux_*"
38
+ CIBW_ARCHS_MACOS: "${{ matrix.macos_arch || 'auto' }}"
39
+ # Set macOS deployment target to match runner OS/arch to satisfy delocate
40
+ CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_target || '11.0' }}"
41
+ CIBW_BEFORE_ALL_LINUX: |
42
+ bash -exc '
43
+ curl -L -o /tmp/gsl.tar.gz https://ftp.gnu.org/gnu/gsl/gsl-2.8.tar.gz
44
+ mkdir -p /tmp/gsl && tar -xzf /tmp/gsl.tar.gz -C /tmp/gsl --strip-components=1
45
+ pushd /tmp/gsl
46
+ ./configure --prefix=/opt/gsl
47
+ make -j"$(nproc)"
48
+ make install
49
+ popd
50
+ # Ensure no stray local build artifacts confuse auditwheel
51
+ rm -rf /project/build /project/bld
52
+ '
53
+ CIBW_ENVIRONMENT_LINUX: |
54
+ PKG_CONFIG_PATH=/opt/gsl/lib/pkgconfig
55
+ CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
56
+ LD_LIBRARY_PATH=/opt/gsl/lib auditwheel repair -w {dest_dir} {wheel}
57
+ run: python -m cibuildwheel --output-dir dist
58
+ - name: List built wheels
59
+ run: ls -lah dist
60
+ - name: Smoke test wheel (Linux)
61
+ if: runner.os == 'Linux'
62
+ run: |
63
+ python -m venv /tmp/wenv
64
+ . /tmp/wenv/bin/activate
65
+ python -m pip install -U pip
66
+ PYTAG=$(python -c 'import sys; print(f"cp{sys.version_info[0]}{sys.version_info[1]}")')
67
+ WHEEL=$(ls dist/pyi2em-*${PYTAG}-*manylinux*.whl | head -n1)
68
+ echo "Installing wheel: $WHEEL"
69
+ python -m pip install "$WHEEL"
70
+ python - <<'PY'
71
+ import pyi2em
72
+ print("pyi2em import OK", pyi2em.__version__ if hasattr(pyi2em, "__version__") else "(no __version__)")
73
+ PY
74
+ - name: Verify bundling (macOS)
75
+ if: runner.os == 'macOS'
76
+ run: |
77
+ python -m pip install -U delocate
78
+ python - <<'PY'
79
+ import glob, subprocess, sys
80
+ wheels = glob.glob('dist/*.whl')
81
+ assert wheels, 'No wheels found'
82
+ for w in wheels:
83
+ print('Checking', w)
84
+ # delocate-listdeps -d exits nonzero if external libs are needed
85
+ subprocess.check_call([sys.executable, '-m', 'delocate.cmd.delocate_listdeps', '-d', w])
86
+ PY
87
+ - name: Smoke test wheel (macOS)
88
+ if: runner.os == 'macOS'
89
+ run: |
90
+ python -m venv /tmp/wenv
91
+ . /tmp/wenv/bin/activate
92
+ python -m pip install -U pip
93
+ PYTAG=$(python -c 'import sys; print(f"cp{sys.version_info[0]}{sys.version_info[1]}")')
94
+ WHEEL=$(ls dist/pyi2em-*${PYTAG}-*macosx*.whl | head -n1)
95
+ echo "Installing wheel: $WHEEL"
96
+ python -m pip install "$WHEEL"
97
+ python - <<'PY'
98
+ import pyi2em
99
+ print("pyi2em import OK", pyi2em.__version__ if hasattr(pyi2em, "__version__") else "(no __version__)")
100
+ PY
101
+ - name: Build sdist
102
+ run: python -m build --sdist
103
+ - name: Publish (PyPI Trusted Publisher)
104
+ # Publish only on Linux runners; container actions aren't supported on macOS/Windows
105
+ if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux'
106
+ uses: pypa/gh-action-pypi-publish@v1.10.1
107
+ with:
108
+ skip-existing: true
@@ -0,0 +1,24 @@
1
+ *.pyc
2
+ *.pyo
3
+ __pycache__/
4
+ *.so
5
+ *.dylib
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ *.egg
10
+ *.log
11
+ *.sqlite3
12
+ .env
13
+ .venv/
14
+ env/
15
+ .vscode/
16
+ bld/
17
+ .idea/
18
+ *.iml
19
+ *.swp
20
+ .DS_Store
21
+ .ipynb_checkpoints/
22
+ .mypy_cache/
23
+ .pytest_cache/
24
+
@@ -0,0 +1,13 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+ project(pyi2em LANGUAGES C CXX)
3
+
4
+ set(CMAKE_CXX_STANDARD 17)
5
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6
+
7
+ find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
8
+ find_package(pybind11 CONFIG REQUIRED)
9
+
10
+ find_package(PkgConfig REQUIRED)
11
+ pkg_check_modules(GSL REQUIRED gsl)
12
+
13
+ add_subdirectory(src)