Skip to content

Commit c046bf4

Browse files
authored
Merge pull request #38 from greglucas/py312-updates
Python 3.12 updates
2 parents 32e4cf4 + 3d335b4 commit c046bf4

File tree

5 files changed

+43
-25
lines changed

5 files changed

+43
-25
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
matrix:
3030
os: [windows-2019, ubuntu-latest, macos-latest]
31-
python-version: ['3.8', '3.9', '3.10', '3.11']
31+
python-version: ['3.9', '3.10', '3.11', '3.12']
3232
defaults:
3333
run:
3434
shell: bash

.github/workflows/wheels.yml

+31-11
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,37 @@ on:
1111
branches:
1212
- 'main'
1313
release:
14+
# Also allow running this action on PRs if requested by applying the
15+
# "Run cibuildwheel" label.
16+
pull_request:
17+
types:
18+
- opened
19+
- synchronize
20+
- reopened
21+
- labeled
1422

1523
jobs:
1624
generate-wheels-matrix:
25+
if: |
26+
github.event_name == 'push' ||
27+
github.event_name == 'release' ||
28+
(github.event_name == 'pull_request' && (
29+
(
30+
github.event.action == 'labeled' &&
31+
github.event.label.name == 'CI: build wheels'
32+
) ||
33+
contains(github.event.pull_request.labels.*.name,
34+
'CI: build wheels')
35+
)
36+
)
1737
name: Generate wheels matrix
1838
runs-on: ubuntu-latest
1939
outputs:
2040
include: ${{ steps.set-matrix.outputs.include }}
2141
steps:
22-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
2343
- name: Install cibuildwheel
24-
run: pipx install cibuildwheel==2.12.0
44+
run: pipx install cibuildwheel==2.16.1
2545
- id: set-matrix
2646
run: |
2747
MATRIX=$(
@@ -36,10 +56,10 @@ jobs:
3656
)
3757
echo "include=$MATRIX" >> $GITHUB_OUTPUT
3858
env:
39-
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-*"
40-
# Skip 32 bit windows builds due to compiler
41-
# Skip musllinux because there aren't musllinux wheels yet
42-
CIBW_SKIP: "*-win32 *-musllinux*"
59+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
60+
# skip 32 bit windows and linux builds because numpy
61+
# does not provide wheels for these platforms
62+
CIBW_SKIP: "*-win32 *_i686"
4363
# TODO: Look into universal2 support, but compilers and options
4464
# will be tricky with the Fortran code and tests...
4565
CIBW_ARCHS_MACOS: x86_64
@@ -54,7 +74,7 @@ jobs:
5474
run:
5575
shell: bash
5676
steps:
57-
- uses: actions/checkout@v3
77+
- uses: actions/checkout@v4
5878

5979
- name: Set up QEMU
6080
if: runner.os == 'Linux'
@@ -85,13 +105,13 @@ jobs:
85105
- name: Set up Python
86106
uses: actions/setup-python@v4
87107
with:
88-
python-version: '3.10'
108+
python-version: '3.12'
89109

90110
- name: Download source files
91111
run: |
92112
python .github/workflows/download_mirror.py
93113
94-
- uses: pypa/cibuildwheel@v2.12.0
114+
- uses: pypa/cibuildwheel@v2.16.1
95115
with:
96116
only: ${{ matrix.only }}
97117

@@ -103,12 +123,12 @@ jobs:
103123
name: Build source distribution
104124
runs-on: ubuntu-latest
105125
steps:
106-
- uses: actions/checkout@v3
126+
- uses: actions/checkout@v4
107127

108128
- uses: actions/setup-python@v4
109129
name: Install Python
110130
with:
111-
python-version: '3.10'
131+
python-version: '3.12'
112132

113133
- name: Download source files
114134
run: |

pymsis/msis.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Interface for running and creating input for the MSIS models."""
22
from pathlib import Path
3-
from typing import List, Optional, Tuple, Union
3+
from typing import Optional, Union
44

55
import numpy as np
66
import numpy.typing as npt
@@ -18,7 +18,7 @@ def run(
1818
f107as: Optional[npt.ArrayLike] = None,
1919
aps: Optional[npt.ArrayLike] = None,
2020
*,
21-
options: Optional[List[float]] = None,
21+
options: Optional[list[float]] = None,
2222
version: Union[float, str] = 2.1,
2323
**kwargs: dict,
2424
) -> npt.NDArray:
@@ -198,7 +198,7 @@ def create_options(
198198
mixed_ut_long: float = 1,
199199
mixed_ap_ut_long: float = 1,
200200
terdiurnal: float = 1,
201-
) -> List[float]:
201+
) -> list[float]:
202202
"""
203203
Create the options list based on keyword argument choices.
204204
@@ -268,7 +268,7 @@ def create_input(
268268
f107s: Optional[npt.ArrayLike] = None,
269269
f107as: Optional[npt.ArrayLike] = None,
270270
aps: Optional[npt.ArrayLike] = None,
271-
) -> Tuple[Tuple, npt.NDArray]:
271+
) -> tuple[tuple, npt.NDArray]:
272272
"""
273273
Combine all input values into a single flattened array.
274274

pymsis/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import warnings
44
from io import BytesIO
55
from pathlib import Path
6-
from typing import Dict, Optional, Tuple
6+
from typing import Optional
77

88
import numpy as np
99
import numpy.typing as npt
@@ -14,7 +14,7 @@
1414
_DATA_FNAME: str = "SW-All.csv"
1515
_F107_AP_URL: str = f"https://celestrak.org/SpaceData/{_DATA_FNAME}"
1616
_F107_AP_PATH: Path = Path(pymsis.__file__).parent / _DATA_FNAME
17-
_DATA: Optional[Dict[str, npt.NDArray]] = None
17+
_DATA: Optional[dict[str, npt.NDArray]] = None
1818

1919

2020
def download_f107_ap() -> None:
@@ -48,7 +48,7 @@ def download_f107_ap() -> None:
4848
f.write(req.read())
4949

5050

51-
def _load_f107_ap_data() -> Dict[str, npt.NDArray]:
51+
def _load_f107_ap_data() -> dict[str, npt.NDArray]:
5252
"""Load data from disk, if it isn't present go out and download it first."""
5353
if not _F107_AP_PATH.exists():
5454
download_f107_ap()
@@ -160,7 +160,7 @@ def _load_f107_ap_data() -> Dict[str, npt.NDArray]:
160160
return data
161161

162162

163-
def get_f107_ap(dates: npt.ArrayLike) -> Tuple[npt.NDArray, npt.NDArray, npt.NDArray]:
163+
def get_f107_ap(dates: npt.ArrayLike) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray]:
164164
"""
165165
Retrieve the F10.7 and ap data needed to run msis for the given times.
166166

pyproject.toml

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
build-backend = "mesonpy"
33
requires = [
44
"meson-python>=0.10.0",
5-
"wheel",
6-
"oldest-supported-numpy"
5+
"numpy>=1.25",
76
]
87

98
[project]
@@ -20,23 +19,22 @@ classifiers = [
2019
"License :: OSI Approved :: MIT License",
2120
"Natural Language :: English",
2221
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.8",
2422
"Programming Language :: Python :: 3.9",
2523
"Programming Language :: Python :: 3.10",
2624
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
2726
"Topic :: Software Development",
2827
"Topic :: Scientific/Engineering",
2928
"Operating System :: Microsoft :: Windows",
3029
"Operating System :: POSIX",
3130
"Operating System :: Unix",
3231
"Operating System :: MacOS",
3332
]
34-
requires-python = ">=3.8"
33+
requires-python = ">=3.9"
3534
dependencies = ["numpy"]
3635

3736
[project.optional-dependencies]
3837
tests = [
39-
"flake8",
4038
"pytest",
4139
"pytest-cov",
4240
]

0 commit comments

Comments
 (0)