Skip to content

Commit b1f5dd8

Browse files
hmacdopeIAlibay
andauthored
Add pyproject.toml and drop support for python < 3.8 (#101)
* 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 <IAlibay@users.noreply.github.com> * add install and setup_requires * remove print_function * remove pip install of reqs Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
1 parent f28fcd2 commit b1f5dd8

File tree

4 files changed

+68
-17
lines changed

4 files changed

+68
-17
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ concurrency:
1717
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
1818
cancel-in-progress: true
1919

20-
defaults:
21-
run:
22-
shell: bash -l {0}
23-
2420
jobs:
2521
build:
22+
defaults:
23+
run:
24+
shell: bash -l {0}
2625
runs-on: ${{matrix.os}}
2726
strategy:
2827
max-parallel: 12
2928
fail-fast: false
3029
matrix:
3130
os: [ubuntu-latest, macos-latest, windows-latest]
32-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
31+
python-version: ['3.8', '3.9', '3.10', '3.11']
3332

3433
steps:
35-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v3
3635
- name: Setup Miniconda
3736
uses: conda-incubator/setup-miniconda@v2
3837
with:
@@ -47,3 +46,37 @@ jobs:
4746
- name: Test with pytest
4847
run: |
4948
pytest -v -ra ./tests/
49+
50+
51+
pip-install:
52+
# A pure Python install, which relies purely on pyproject.toml contents
53+
defaults:
54+
run:
55+
shell: bash {0}
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os: [ubuntu-latest, macos-latest, windows-latest]
61+
python: ["3.8", "3.9", "3.10", "3.11"]
62+
63+
steps:
64+
- uses: actions/checkout@v3
65+
66+
- uses: actions/setup-python@v4
67+
with:
68+
python-version: ${{ matrix.python }}
69+
70+
- name: check_env
71+
run: |
72+
which python
73+
python -m pip list
74+
- name: build
75+
run: python -m pip -v install .
76+
77+
- name: install_reqs
78+
run: pip install pytest
79+
80+
- name: pytests
81+
run: |
82+
pytest -v -ra ./tests/

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[build-system]
2+
# Minimum requirements for the build system to execute
3+
requires = [
4+
"cython>=0.28,<3.0",
5+
"setuptools",
6+
"wheel",
7+
# below matches MDA
8+
"numpy==1.20.0; python_version=='3.8' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_python_implementation != 'PyPy'",
9+
"numpy==1.20.0; python_version=='3.9' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_python_implementation != 'PyPy'",
10+
# arm64 on darwin for py3.8+ requires numpy >=1.21.0
11+
"numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation != 'PyPy'",
12+
"numpy==1.21.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation != 'PyPy'",
13+
# Scipy: On windows avoid 1.21.6, 1.22.0, and 1.22.1 because they were built on vc142
14+
"numpy==1.22.3; python_version=='3.10' and platform_system=='Windows' and platform_python_implementation != 'PyPy'",
15+
# As per https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
16+
# safest to build at 1.21.6 for all other platforms
17+
"numpy==1.21.6; python_version=='3.10' and platform_system !='Windows'and platform_python_implementation != 'PyPy'",
18+
"numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'",
19+
"numpy<2.0; python_version>='3.12'",
20+
]

setup.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ style = pep440
44
versionfile_source = pytng/_version.py
55
versionfile_build = pytng/_version.py
66
tag_prefix =
7-
parentdir_prefix = pytng-
7+
parentdir_prefix = pytng-
8+
9+
[options]
10+
setup_requires =
11+
numpy>=1.20.0
12+
cython>=0.28,<3.0
13+
install_requires =
14+
numpy>=1.20.0

setup.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
from __future__ import print_function
2-
31
import os
42
import sys
53
import versioneer
64
from glob import glob
75

86
from setuptools import setup, Command, Extension
97

10-
# Make sure I have the right Python version.
11-
if sys.version_info[:2] < (3, 6):
12-
print('MDAnalysis requires Python 3.6 or better. Python {0:d}.{1:d} detected'.format(*
13-
sys.version_info[:2]))
14-
print('Please upgrade your version of Python.')
15-
sys.exit(-1)
16-
178
try:
189
import numpy as np
1910
except ImportError:
@@ -71,7 +62,7 @@ def extensions():
7162

7263
setup(
7364
name="pytng",
74-
python_requires=">=3.6",
65+
python_requires=">=3.8",
7566
version=versioneer.get_version(),
7667
description='Minimal Cython wrapper of the TNG trajectory library',
7768
long_description=long_description,

0 commit comments

Comments
 (0)