Skip to content

Commit

Permalink
Add pyproject.toml and drop support for python < 3.8 (#101)
Browse files Browse the repository at this point in the history
* add pyproject.toml

* clean up setup.py for py3.8 minimum

* update CI

* remove packaging

* add wheel build

* add in runtime deps

* try python3 kludge

* change shell to pickup right python version

* revert python3 kludging

* add activate step

* Revert "add activate step"

This reverts commit 5e74c6e.

* change shell for each setup

* remove defaulkt shell

* delete empty

* split shell defaults

* Update pyproject.toml

Co-authored-by: Irfan Alibay <[email protected]>

* add install and setup_requires

* remove print_function

* remove pip install of reqs

Co-authored-by: Irfan Alibay <[email protected]>
  • Loading branch information
hmacdope and IAlibay authored Dec 20, 2022
1 parent f28fcd2 commit b1f5dd8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 17 deletions.
45 changes: 39 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
build:
defaults:
run:
shell: bash -l {0}
runs-on: ${{matrix.os}}
strategy:
max-parallel: 12
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -47,3 +46,37 @@ jobs:
- name: Test with pytest
run: |
pytest -v -ra ./tests/
pip-install:
# A pure Python install, which relies purely on pyproject.toml contents
defaults:
run:
shell: bash {0}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3

- 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 -v install .

- name: install_reqs
run: pip install pytest

- name: pytests
run: |
pytest -v -ra ./tests/
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[build-system]
# Minimum requirements for the build system to execute
requires = [
"cython>=0.28,<3.0",
"setuptools",
"wheel",
# below matches MDA
"numpy==1.20.0; python_version=='3.8' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_python_implementation != 'PyPy'",
"numpy==1.20.0; python_version=='3.9' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_python_implementation != 'PyPy'",
# arm64 on darwin for py3.8+ requires numpy >=1.21.0
"numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation != 'PyPy'",
"numpy==1.21.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation != 'PyPy'",
# Scipy: On windows avoid 1.21.6, 1.22.0, and 1.22.1 because they were built on vc142
"numpy==1.22.3; python_version=='3.10' and platform_system=='Windows' 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 other platforms
"numpy==1.21.6; python_version=='3.10' and platform_system !='Windows'and platform_python_implementation != 'PyPy'",
"numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'",
"numpy<2.0; python_version>='3.12'",
]
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ style = pep440
versionfile_source = pytng/_version.py
versionfile_build = pytng/_version.py
tag_prefix =
parentdir_prefix = pytng-
parentdir_prefix = pytng-

[options]
setup_requires =
numpy>=1.20.0
cython>=0.28,<3.0
install_requires =
numpy>=1.20.0
11 changes: 1 addition & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
from __future__ import print_function

import os
import sys
import versioneer
from glob import glob

from setuptools import setup, Command, Extension

# Make sure I have the right Python version.
if sys.version_info[:2] < (3, 6):
print('MDAnalysis requires Python 3.6 or better. Python {0:d}.{1:d} detected'.format(*
sys.version_info[:2]))
print('Please upgrade your version of Python.')
sys.exit(-1)

try:
import numpy as np
except ImportError:
Expand Down Expand Up @@ -71,7 +62,7 @@ def extensions():

setup(
name="pytng",
python_requires=">=3.6",
python_requires=">=3.8",
version=versioneer.get_version(),
description='Minimal Cython wrapper of the TNG trajectory library',
long_description=long_description,
Expand Down

0 comments on commit b1f5dd8

Please sign in to comment.