diff --git a/.github/workflows/analyzers.yaml b/.github/workflows/analyzers.yaml index 8f1957d86..d4aa92ee6 100644 --- a/.github/workflows/analyzers.yaml +++ b/.github/workflows/analyzers.yaml @@ -11,7 +11,7 @@ jobs: cppcheck: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: './.github/actions/build_core_dependencies' with: @@ -41,7 +41,7 @@ jobs: scan_build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: './.github/actions/build_core_dependencies' with: @@ -69,7 +69,7 @@ jobs: valgrind: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: './.github/actions/build_core_dependencies' with: @@ -96,7 +96,7 @@ jobs: debug: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: './.github/actions/build_core_dependencies' with: diff --git a/.github/workflows/bigendian.yaml b/.github/workflows/bigendian.yaml index 7a4206861..3b8e83c11 100644 --- a/.github/workflows/bigendian.yaml +++ b/.github/workflows/bigendian.yaml @@ -14,17 +14,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: builder: ${{ steps.buildx.outputs.name }} context: . diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml index 2ac9aa300..13205df72 100644 --- a/.github/workflows/core.yaml +++ b/.github/workflows/core.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [macos-11] + os: [macos-13, macos-14] include: - os: ubuntu-20.04 @@ -27,7 +27,7 @@ jobs: cmake_generator: "-G \"Visual Studio 16 2019\" -A Win32" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Elevate privileges if: ${{ !contains( matrix.os, 'windows') }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index b97bba824..aa8418e0d 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -12,9 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml new file mode 100644 index 000000000..bce5e250a --- /dev/null +++ b/.github/workflows/python.yaml @@ -0,0 +1,62 @@ +name: Build and test python +#Build and test with python turned on + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +jobs: + build_python: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + - os: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + + - uses: "./.github/actions/build_core_dependencies" + with: + privileges: "sudo" + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Create python venv + shell: bash + run: | + python -m venv venv + . ./venv/bin/activate + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools + python -m pip install -r python/requirements-dev.txt + which python + + - name: Configure dlisio + shell: bash + run: | + . ./venv/bin/activate + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DBUILD_PYTHON=ON + + - name: Build dlisio + shell: bash + run: | + sudo cmake \ + --build build \ + --parallel \ + --config Release + + - name: Test dlisio + shell: bash + run: | + cd build + ctest -C Release --output-on-failure --verbose diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index 30ad81efa..ed3933b47 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -29,10 +29,10 @@ jobs: - os: ubuntu-20.04 arch: aarch64 - os: ubuntu-20.04 - arch: i686 - - os: macos-11 + arch: i686 #builds from cibuildwheel, qemu not needed + - os: macos-13 arch: x86_64 - - os: macos-13-xlarge + - os: macos-14 arch: arm64 steps: @@ -40,14 +40,14 @@ jobs: run: | git config --global core.autocrlf false - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Used to host cibuildwheel - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-qemu-action@v3 if: ${{ matrix.arch == 'aarch64' }} name: Set up QEMU @@ -66,15 +66,17 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} # musllinux arch skip: unlikely someone wants to run dlisio on alpine on non-standard architecture - # musllinux cp37 and cp38 skip: latest available numpy doesn't provide musslinux wheels, so it is unlikely useful - # macosx 38 skip: cibuildwheel can't test it - CIBW_SKIP: pp* *-musllinux_i686 *-musllinux_aarch64 cp37*-musllinux* cp38*-musllinux* cp38*-macosx_*:arm64 cp36-* + # musllinux cp38 skip: latest available numpy doesn't provide musslinux wheels, so it is unlikely useful + # macosx arm 38 skip: cibuildwheel can't test it + # 36, 37, 313 skip: python versions not supported + CIBW_SKIP: pp* *-musllinux_i686 *-musllinux_aarch64 cp38*-musllinux* cp38*-macosx_*arm64 cp36-* cp37-* cp313-* run: | python -m cibuildwheel --output-dir wheelhouse python/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: + name: wheel-${{ matrix.os }}-${{ matrix.arch }} path: ./wheelhouse/*.whl publish: @@ -83,9 +85,13 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 + with: + pattern: wheel-* + merge-multiple: true + path: ./wheelhouse/ - name: Publish wheels to PyPI diff --git a/README.md b/README.md index ef7ed28ad..08cd94b6b 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ pip install dlisio | | macOS Intel | macOS ARM | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux aarch64 | manylinux i686 | musllinux x86_64 |---------------|----|-----|-----|----|----|----|----|----| -| CPython 3.7 | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ | - | | CPython 3.8 | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ | - | | CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | @@ -97,13 +96,13 @@ To develop dlisio, or to build a particular revision from source, you need: * A C++11 compatible compiler (tested on gcc, clang, and msvc 2019) * [CMake](https://cmake.org/) version 3.5 or greater -* [Python](https://python.org) version 3.7 or greater +* [Python](https://python.org) version 3.8 or greater * [fmtlib](http://fmtlib.net/) tested mainly with 7.1.3 * [mpark_variant](https://github.com/mpark/variant) * [pybind11](https://github.com/pybind/pybind11) version 2.6 or greater * [setuptools](https://pypi.python.org/pypi/setuptools) version 28 or greater * [layered-file-protocols](https://github.com/equinor/layered-file-protocols) -* python packages pytest, pytest-runner, and numpy +* python packages pytest and numpy If you do not have pybind11 installed on your system, the easiest way to get a working copy is to `pip3 install pybind11` (NP! pybind11, not pybind) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index e3a4aa961..5c0d9562a 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -137,6 +137,6 @@ endif() # different args to setup.py, rebuilding the python lib (and wrongly so as it # either won't find dlisio or picked up on a system installed one) add_test(NAME python.unit - COMMAND ${python} ${setup.py} --skip-cmake test + COMMAND ${python} -m pytest tests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/python/dlisio/__init__.py b/python/dlisio/__init__.py index 3b02b06d4..31a820cfe 100644 --- a/python/dlisio/__init__.py +++ b/python/dlisio/__init__.py @@ -3,18 +3,8 @@ from . import lis from . import dlis -import sys - -# remove else once support for python 3.7 is over -if sys.version_info >= (3, 8): - try: - import importlib.metadata - __version__ = importlib.metadata.version(__name__) - except importlib.metadata.PackageNotFoundError: - pass -else: - try: - import pkg_resources - __version__ = pkg_resources.get_distribution(__name__).version - except pkg_resources.DistributionNotFound: - pass +try: + import importlib.metadata + __version__ = importlib.metadata.version(__name__) +except importlib.metadata.PackageNotFoundError: + pass diff --git a/python/pyproject.toml b/python/pyproject.toml index 2f6bc6795..942b38d9a 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,6 @@ requires = [ "scikit-build", "wheel", "pybind11", - "pytest-runner", ] [tool.cibuildwheel] diff --git a/python/requirements-dev.txt b/python/requirements-dev.txt index 7582d753c..51fb60538 100644 --- a/python/requirements-dev.txt +++ b/python/requirements-dev.txt @@ -1,10 +1,9 @@ bandit -numpy<2.0 +numpy setuptools setuptools_scm pytest -pytest-runner pybind11 hypothesis sphinx diff --git a/python/setup.cfg b/python/setup.cfg index fa8d22139..6dd760052 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -1,5 +1,2 @@ [metadata] version = 1.0.1 - -[aliases] -test = pytest diff --git a/python/setup.py b/python/setup.py index 4bbc82283..6da649f55 100755 --- a/python/setup.py +++ b/python/setup.py @@ -2,7 +2,6 @@ import os import skbuild -import setuptools class get_pybind_include(object): def __init__(self, user=False): @@ -36,13 +35,11 @@ def get_long_description(): packages = ['dlisio', 'dlisio.dlis', 'dlisio.lis', 'dlisio.common', 'dlisio.dlis.utils'], license = 'LGPL-3.0', platforms = 'any', - install_requires = ['numpy < 2.0'], + install_requires = ['numpy'], setup_requires = ['setuptools >= 28', 'pybind11 >= 2.3', 'setuptools_scm', - 'pytest-runner', ], - tests_require = ['pytest'], # we're building with the pybind11 fetched from pip. Since we don't rely on # a cmake-installed pybind there's also no find_package(pybind11) - # instead, the get include dirs from the package and give directly from @@ -54,7 +51,4 @@ def get_long_description(): # supported OS X release 10.9 '-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9', ], - # skbuild's test imples develop, which is pretty obnoxious instead, use a - # manually integrated pytest. - cmdclass = { 'test': setuptools.command.test.test }, )