Skip to content

Commit

Permalink
Set numpy build requirements, drop py3.7, add pure Python build CI (#115
Browse files Browse the repository at this point in the history
)

* Add minimum deps requirements in requirements.txt / setup.cdf
* Set numpy versions in pyproject.toml
* Drop Python 3.7
* Add CI job for a pure Python / pip build

TODOs:
* Pure Python / pip build for Windows does not work at this moment in time
  • Loading branch information
IAlibay authored Oct 20, 2022
1 parent 6c5d7c1 commit 29f6a50
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 17 deletions.
61 changes: 55 additions & 6 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
name: CMake

on: [push,pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

defaults:
run:
shell: bash

concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.worfklow }}"
cancel-in-progress: true

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
Expand All @@ -22,7 +36,7 @@ jobs:
"-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_AVX=ON -DDISTOPIA_BUILD_TEST=ON",
"-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_AVX2=ON -DDISTOPIA_BUILD_TEST=ON",
"-DDISTOPIA_DISPATCH=ON -DDISTOPIA_DISPATCH_MANUAL=ON -DDISTOPIA_USE_SSE3=ON -DDISTOPIA_USE_SSE4_1=ON -DDISTOPIA_USE_AVX=ON -DDISTOPIA_BUILD_TEST=ON"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: macos-latest
cxx_compiler: "clang++"
Expand All @@ -42,20 +56,55 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: BSFishy/pip-action@v1
with:
requirements: requirements.txt

- name: check_env
run: |
which python
python -m pip list
- name: Build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: python3 setup.py build -- ${{ matrix.instruction_set_flag }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
run: python setup.py build -- ${{ matrix.instruction_set_flag }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}

- name: Test
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia

pip-install:
# A pure Python install, which relies purely on pyproject.toml contents
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# for now windows pip install builds seem to fail for some reason
os: [ubuntu-latest, macos-latest,]
python: ["3.8", "3.9", "3.10", "3.11.0-rc.2"]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: check_env
run: |
which python
python -m pip list
- name: build
run: python -m pip install .

- name: test
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia
17 changes: 14 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
requires = [
"setuptools>=42",
"wheel",
"numpy",
# declaring numpy versions specifically to x86_64
# lowest NumPy we can use for a given Python,
# except for more exotic platform (Mac Arm flavors)
# Also don't allow PyPy builds
"numpy==1.20.0; python_version=='3.8' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'",
"numpy==1.20.0; python_version=='3.9' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'",
# As per https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
# safest to build at 1.21.6 for all platforms
"numpy==1.21.6; python_version=='3.10' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'",
"numpy==1.23.2; python_version=='3.11' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'",
# default to just numpy for unknown versions of Python
"numpy; python_version>='3.12'",
"scikit-build",
"cmake",
"cython",
"cython>=0.28,<3.0",
"versioneer-518",
"ninja; platform_system!='Windows'"
]
Expand All @@ -17,4 +28,4 @@ style = "pep440"
versionfile_source = "distopia/_version.py"
versionfile_build = "distopia/_version.py"
tag_prefix = ""
parentdir_prefix = "distopia-"
parentdir_prefix = "distopia-"
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake
cython
numpy
cython>=0.28.0,<3.0.0
numpy>=1.20.0
ninja
scikit-build
scikit-build
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author=['Hugo MacDermott-Opeskin', "Richard Gowers"],
license="MIT",
packages=['distopia'],
python_requires=">=3.7",
python_requires=">=3.8",
keywords=(
"molecular dynamics distances simulation SIMD"
),
Expand All @@ -20,7 +20,6 @@
"License :: OSI Approved :: MIT License",
"Programming Language :: C++",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -37,9 +36,9 @@
"Issue Tracker": "https://github.com/MDAnalysis/distopia/issues",
},
install_requires=[
"numpy",
"cython",
"numpy>=1.20.0",
"cython>=0.28.0,<3.0.0",
"scikit-build",
"cmake"
],
)
)

0 comments on commit 29f6a50

Please sign in to comment.