diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yaml similarity index 57% rename from .github/workflows/build_wheels.yml rename to .github/workflows/build_wheels.yaml index daaf86b0..1d10855e 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yaml @@ -5,71 +5,80 @@ concurrency: cancel-in-progress: true on: - # Trigger on pull requests. pull_request: - # Trigger on pushes to the mainline branches and version tags. This prevents building commits - # twice when the pull request source branch is in the same repository. push: branches: - - "trunk-patch" - - "trunk-minor" - - "trunk-major" + - "trunk-*" tags: - "v*" - # Trigger on request. workflow_dispatch: +env: + UV_VERSION: 0.2.2 + jobs: build_wheels: - name: Build wheels [py${{ matrix.python_version }}, ${{ matrix.os }}] - runs-on: ${{ matrix.os }}-${{ matrix.os_version }} + name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}] + runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }} strategy: fail-fast: false matrix: - os: [ubuntu, windows, macos] - python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - include: - - os_version: 'latest' - - - os: 'macos' - os_version: '14' + os: + - base: ubuntu + version: latest + arch: 'x86_64' + - base: windows + version: latest + arch: 'amd64' + - base: macos + version: 14 + arch: 'arm64' + - base: macos + version: 13 + arch: 'x86_64' + + python: + - version: 'cp39' + oldest_numpy: '1.21.6' + - version: 'cp310' + oldest_numpy: '1.21.6' + - version: 'cp311' + oldest_numpy: '1.23.2' + - version: 'cp312' + oldest_numpy: '1.26.2' steps: - - uses: actions/checkout@v4.1.4 + - uses: actions/checkout@v4.1.6 - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.18.1 env: - CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*" + CIBW_BUILD: "${{ matrix.python.version }}-*" + CIBW_TEST_REQUIRES: pytest==8.2.1 numpy==${{ matrix.python.oldest_numpy }} - uses: actions/upload-artifact@v4.3.3 with: - name: dist-python-${{ matrix.python_version }}-${{ matrix.os }} + name: dist-python-${{ matrix.python.version }}-${{ matrix.os.base }}-${{ matrix.os.arch }} path: ./wheelhouse/*.whl build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.4 + - uses: actions/checkout@v4.1.6 - uses: actions/setup-python@v5.1.0 name: Install Python with: - python-version: '3.11' + python-version: '3.12' - - uses: actions/cache@v4.0.2 - with: - path: ~/.cache/pip - key: gsd-build-wheels-pip-${{ hashFiles('.github/requirements-build-sdist.txt') }} - restore-keys: | - gsd-build-wheels-pip- + - name: Install uv + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash - name: Install build - run: python3 -m pip --disable-pip-version-check install -r .github/requirements-build-sdist.txt --progress-bar=off + run: 'uv pip install -r .github/requirements-build-sdist.txt --only-binary :all: --system --reinstall' - name: Build sdist run: python -m build --sdist --outdir dist/ . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 80% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index eee74673..adb866c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -5,20 +5,14 @@ concurrency: cancel-in-progress: true on: - # Trigger on pull requests. pull_request: - # Trigger on pushes to the mainline branches and version tags. This prevents building commits - # twice when the pull request source branch is in the same repository. push: branches: - - "trunk-patch" - - "trunk-minor" - - "trunk-major" + - "trunk-*" tags: - "v*" - # Trigger on request. workflow_dispatch: env: @@ -32,17 +26,17 @@ jobs: release: name: Build release tarball runs-on: ubuntu-latest - container: - image: glotzerlab/ci:2023.10.09-ubuntu22.04 - options: -u 0 steps: - - uses: actions/checkout@v4.1.4 + - uses: actions/checkout@v4.1.6 with: fetch-depth: 0 submodules: true path: code + - name: Install tools + run: sudo apt-get install pcregrep pandoc + - name: Determine last tag via git describe if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} run: echo tag="$(git describe --abbrev=0)" >> "$GITHUB_ENV" @@ -66,11 +60,14 @@ jobs: - name: Tar source run: tar -cvzf "${name}-${tag:1}.tar.gz" "${name}-${tag:1}" + - name: Tar source + run: tar -cvJf "${name}-${tag:1}.tar.xz" "${name}-${tag:1}" + - uses: actions/upload-artifact@v4.3.3 with: name: release path: | - *.tar.gz + *.tar.* changelog.md publish: @@ -88,7 +85,7 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v') with: - files: "*.tar.gz" + files: "*.tar.*" body_path: changelog.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yaml similarity index 97% rename from .github/workflows/stale.yml rename to .github/workflows/stale.yaml index a356f559..b7d7c0f6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yaml @@ -4,7 +4,6 @@ on: schedule: - cron: '0 19 * * *' - # Trigger on request. workflow_dispatch: jobs: diff --git a/.github/workflows/style_check.yaml b/.github/workflows/style_check.yaml new file mode 100644 index 00000000..1287f538 --- /dev/null +++ b/.github/workflows/style_check.yaml @@ -0,0 +1,48 @@ +name: Style check + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + + push: + branches: + - "trunk-*" + + workflow_dispatch: + +env: + UV_VERSION: 0.2.2 + +jobs: + clang-tidy: + name: Run clang-tidy + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.6 + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: 3.12 + - name: Install uv + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash + - name: Install prereqs + run: 'uv pip install -r .github/requirements-test.txt --only-binary :all: --system --reinstall' + - name: Configure + run: cmake -B build + - name: Execute clang-tidy + run: clang-tidy-14 -p=build gsd/*.c gsd/*.h scripts/*.cc --quiet --warnings-as-errors="*" + + # This job is used to provide a single requirement for branch merge conditions. + checks_complete: + name: Style check + if: always() + needs: [clang-tidy] + runs-on: ubuntu-latest + + steps: + - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' + - name: Done + run: exit 0 diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml deleted file mode 100644 index 9976cb4f..00000000 --- a/.github/workflows/style_check.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Style check - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - # Trigger on pull requests. - pull_request: - - # Trigger on pushes to the mainline branches and version tags. This prevents building commits - # twice when the pull request source branch is in the same repository. - push: - branches: - - "trunk-patch" - - "trunk-minor" - - "trunk-major" - - # Trigger on request. - workflow_dispatch: - -jobs: - clang-tidy: - name: Run clang-tidy - runs-on: ubuntu-latest - container: - image: glotzerlab/ci:2023.10.09-clang14_py311 - steps: - - uses: actions/checkout@v4.1.4 - - name: Configure - run: cmake -B build - - name: Execute clang-tidy - run: clang-tidy -p=build gsd/*.c gsd/*.h scripts/*.cc --quiet --warnings-as-errors="*" - - # This job is used to provide a single requirement for branch merge conditions. - checks_complete: - name: Style check - needs: [clang-tidy] - runs-on: ubuntu-latest - - steps: - - run: echo "Done!" diff --git a/.github/workflows/unit_test.yaml b/.github/workflows/unit_test.yaml new file mode 100644 index 00000000..2d7d3b39 --- /dev/null +++ b/.github/workflows/unit_test.yaml @@ -0,0 +1,147 @@ +name: Unit test + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + + push: + branches: + - "trunk-*" + + workflow_dispatch: + +defaults: + run: + shell: bash + +env: + UV_VERSION: 0.2.2 + +jobs: + unit_test: + name: Unit test [py${{ matrix.python }} ${{ matrix.c_compiler }} ${{ matrix.os }}] + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + ############## + # Windows + - os: windows-2019 + python: '3.12' + - os: windows-2022 + python: '3.12' + ############## + # Mac + # macos-x86_64 + - os: macos-12 + python: '3.12' + # macos-arm64 + - os: macos-14 + python: '3.12' + ############## + # Ubuntu 24.04 + - os: ubuntu-24.04 + python: '3.9' + c_compiler: gcc-13 + cxx_compiler: g++-14 + - os: ubuntu-24.04 + python: '3.10' + c_compiler: gcc-14 + cxx_compiler: g++-14 + - os: ubuntu-24.04 + python: '3.11' + c_compiler: clang-16 + cxx_compiler: clang++-16 + - os: ubuntu-24.04 + python: '3.12' + c_compiler: clang-17 + cxx_compiler: clang++-17 + - os: ubuntu-24.04 + python: '3.12' + c_compiler: clang-18 + cxx_compiler: clang++-18 + ############## + # Ubuntu 22.04 + - os: ubuntu-22.04 + python: '3.9' + c_compiler: gcc-11 + cxx_compiler: g++-11 + - os: ubuntu-22.04 + python: '3.10' + c_compiler: gcc-12 + cxx_compiler: g++-12 + - os: ubuntu-22.04 + python: '3.11' + c_compiler: clang-13 + cxx_compiler: clang++-13 + - os: ubuntu-22.04 + python: '3.12' + c_compiler: clang-14 + cxx_compiler: clang++-14 + - os: ubuntu-22.04 + python: '3.12' + c_compiler: clang-15 + cxx_compiler: clang++-15 + ############## + # Ubuntu 20.04 + - os: ubuntu-20.04 + python: '3.9' + c_compiler: gcc-10 + cxx_compiler: g++-10 + - os: ubuntu-20.04 + python: '3.10' + c_compiler: clang-10 + cxx_compiler: clang++-10 + - os: ubuntu-20.04 + python: '3.11' + c_compiler: clang-11 + cxx_compiler: clang++-11 + - os: ubuntu-20.04 + python: '3.12' + c_compiler: clang-12 + cxx_compiler: clang++-12 + + steps: + - uses: actions/checkout@v4.1.6 + with: + path: code + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: ${{ matrix.python }} + - name: Install uv + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash + - name: Install prereqs + run: 'uv pip install -r code/.github/requirements-test.txt --only-binary :all: --system --reinstall' + - name: Set Linux compiler + if: ${{ startsWith(matrix.os, 'ubuntu') }} + run: | + echo "CC=${{ matrix.c_compiler }}" >> "$GITHUB_ENV" + echo "CXX=${{ matrix.cxx_compiler }}" >> "$GITHUB_ENV" + - name: Configure + run: cmake -S code -B build + - name: Build + run: cmake --build build -j 6 --config Release + - if: runner.os == 'Windows' + name: Copy pyd files + run: cp ./gsd/Release/*.pyd gsd/ + working-directory: build + - name: Run tests + run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG + env: + PYTHONPATH: ${{ github.workspace }}/build + + # This job is used to provide a single requirement for branch merge conditions. + tests_complete: + name: Unit test + if: always() + needs: [unit_test] + runs-on: ubuntu-latest + + steps: + - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' + - name: Done + run: exit 0 diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml deleted file mode 100644 index 44f7b693..00000000 --- a/.github/workflows/unit_test.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Unit test - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - # Trigger on pull requests. - pull_request: - - # Trigger on pushes to the mainline branches and version tags. This prevents building commits - # twice when the pull request source branch is in the same repository. - push: - branches: - - "trunk-patch" - - "trunk-minor" - - "trunk-major" - - # Trigger on request. - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - unit_test_linux: - name: Unit test on Linux [${{ matrix.image }}] - runs-on: ubuntu-latest - container: - image: glotzerlab/ci:2023.10.09-${{ matrix.image }} - options: -u 0 - strategy: - matrix: - image: [gcc13_py312, - clang14_py311, - clang13_py310, - clang12_py310, - gcc12_py311, - gcc11_py310, - clang11_py310, - gcc10_py310, - gcc9_py39, - clang10_py38] - - steps: - - uses: actions/checkout@v4.1.4 - with: - path: code - - name: Configure - run: mkdir -p build && cd build && cmake ../code -GNinja - - name: Build - run: ninja - working-directory: build - - name: Run tests - run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG - env: - PYTHONPATH: ${{ github.workspace }}/build - - unit_test_other: - name: Unit test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-12, macos-14, windows-2019, windows-2022] - - steps: - - uses: actions/checkout@v4.1.4 - with: - path: code - - name: Set up Python - uses: actions/setup-python@v5.1.0 - with: - python-version: '3.11' - - name: Get pip cache dir - id: pip-cache - run: echo dir="$(pip cache dir)" >> "$GITHUB_OUTPUT" - - uses: actions/cache@v4.0.2 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: gsd-unit-test-${{ matrix.os }}-pip-${{ hashFiles('code/.github/requirements-test.txt') }} - restore-keys: | - gsd-unit-test-${{ matrix.os }}-pip- - - name: Install prereqs - run: python3 -m pip install -r code/.github/requirements-test.txt - - name: Configure - run: cmake -S code -B build - - name: Build - run: cmake --build build -j 4 --config Release - - if: runner.os == 'Windows' - name: Copy pyd files - run: cp ./gsd/Release/*.pyd gsd/ - working-directory: build - - name: Run tests - run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG - env: - PYTHONPATH: ${{ github.workspace }}/build - - # This job is used to provide a single requirement for branch merge conditions. - tests_complete: - name: Unit test - needs: [unit_test_linux, unit_test_other] - runs-on: ubuntu-latest - - steps: - - run: echo "Done!" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7d181ae5..f47c9112 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,11 @@ Change Log 3.3.0 (not yet released) ^^^^^^^^^^^^^^^^^^^^^^^^ +*Added:* + +* Support numpy 2.0 + (`#367 `__). + *Changed:* * Navigate the documentation with arrow keys @@ -22,6 +27,11 @@ Change Log * Remove singularity reference from the documentation (`#365 `__). +*Removed:* + +* Support for Python 3.8 + (`#367 `__). + 3.2.1 (2024-01-22) ^^^^^^^^^^^^^^^^^^ diff --git a/INSTALLING.rst b/INSTALLING.rst index e6b3c937..5d1bdff2 100644 --- a/INSTALLING.rst +++ b/INSTALLING.rst @@ -109,9 +109,9 @@ Install prerequisites **General requirements:** -* **C compiler** (tested with gcc 9-12, clang 10-14, visual studio 2019-2022) -* **Python** >= 3.8 -* **numpy** >= 1.17.3 +* **C compiler** (tested with gcc 10-14, clang 10-18, Visual Studio 2019-2022) +* **Python** >= 3.9 +* **numpy** >= 1.19.0 * **Cython** >= 0.22 **To build the documentation**: diff --git a/pyproject.toml b/pyproject.toml index 4f15af4f..1f0545e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers=[ "License :: OSI Approved :: BSD License", "Topic :: Scientific/Engineering :: Physics", ] -dependencies = ["numpy>=1.9.3"] +dependencies = ["numpy>=1.19.0"] [project.scripts] gsd = "gsd.__main__:main" @@ -36,24 +36,15 @@ packages = ["gsd", "gsd.test"] requires = ["setuptools>=64.0.0", "wheel", "Cython", - "oldest-supported-numpy"] + "numpy>=2.0.0rc1"] [tool.cibuildwheel] -# Build for cpython only -skip = "pp*" - # Test the wheels. test-command = "pytest --pyargs gsd -v --log-level=DEBUG" -test-skip = "*-macosx_arm64" -test-requires = "pytest" -# Build only on 64-bit architectures. +# Build on 64-bit architectures. archs = ["auto64"] -[tool.cibuildwheel.macos] -# Build for x86_64 and arm64 -archs = ["x86_64", "arm64"] - [tool.cibuildwheel.linux] # dependencies do not build for musl skip = ["pp* *musllinux*"]