Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Python3.13 and minor updates #56

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

- name: Download source files
run: |
Expand All @@ -38,7 +38,7 @@ jobs:
cd docs
make html

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: DocumentationHTML
path: docs/build/html/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-14]
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
defaults:
run:
shell: bash
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
steps:
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v3

- name: Download source files
run: |
python .github/workflows/download_mirror.py
Expand Down Expand Up @@ -78,12 +75,13 @@ jobs:
echo "PYTHONUTF8=1" >> $GITHUB_ENV

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
# skip 32 bit windows and linux builds because numpy
# does not provide wheels for these platforms
CIBW_SKIP: "*-win32 *_i686"
# The brew built gfortran linked libraries have minimum macOS versions
# of the macOS version they were built on. We would need to compile
# from source rather than use setup-fortran if we want to support
# lower macOS versions.
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}"

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
autoupdate_schedule: 'quarterly'
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.5.0'
rev: 'v0.7.3'
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors:
Atmospheric and Space Physics (LASP)
orcid: "https://orcid.org/0000-0003-1331-1863"
title: "pymsis"
version: v0.9.0
version: v0.10.0
doi: 10.5281/zenodo.5348502
date-released: 2024-04-04
url: "https://github.com/SWxTREC/pymsis"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ models (MSISE-00, MSIS2.0, MSIS2.1).

## Quickstart

[Web viewer](https://swx-trec.com/msis): An interactive website using pymsis through cloud-based serverless functions.
[Project homepage](https://swxtrec.github.io/pymsis/): Location for all documentation.
[API Reference](https://swxtrec.github.io/pymsis/reference/index.html): Details about the various options and configurations available in the functions.
[Examples](https://swxtrec.github.io/pymsis/examples/index.html): Demo for how to access and plot the data.
- [Documentation](https://swxtrec.github.io/pymsis/)
- [API Reference](https://swxtrec.github.io/pymsis/reference/index.html): Details about the various options and configurations available in the functions.
- [Examples](https://swxtrec.github.io/pymsis/examples/index.html): Demo for how to access and plot the data.
- [Web viewer](https://swx-trec.com/msis): An interactive website using pymsis through cloud-based serverless functions.

**A few short lines of code to get started quickly with pymsis.**

Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

# Autosummary
autosummary_generate = True
autodoc_typehints = "none"

# Sphinx gallery
sphinx_gallery_conf = {
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(
'pymsis',
'c',
# Note that the git commit hash cannot be added dynamically here
version: '0.9.0',
version: '0.10.0',
license: 'MIT',
meson_version: '>=1.2.99',
default_options: [
Expand Down
2 changes: 1 addition & 1 deletion pymsis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Python interface to the MSIS codes."""

__version__ = "0.9.0"
__version__ = "0.10.0"
19 changes: 9 additions & 10 deletions pymsis/msis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Interface for running and creating input for the MSIS models."""

from pathlib import Path
from typing import Optional, Union

import numpy as np
import numpy.typing as npt
Expand All @@ -15,12 +14,12 @@ def run(
lons: npt.ArrayLike,
lats: npt.ArrayLike,
alts: npt.ArrayLike,
f107s: Optional[npt.ArrayLike] = None,
f107as: Optional[npt.ArrayLike] = None,
aps: Optional[npt.ArrayLike] = None,
f107s: npt.ArrayLike | None = None,
f107as: npt.ArrayLike | None = None,
aps: npt.ArrayLike | None = None,
*,
options: Optional[list[float]] = None,
version: Union[float, str] = 2.1,
options: list[float] | None = None,
version: float | str = 2.1,
**kwargs: dict,
) -> npt.NDArray:
"""
Expand Down Expand Up @@ -69,7 +68,7 @@ def run(
-------
ndarray (ndates, nlons, nlats, nalts, 11) or (ndates, 11)
| The data calculated at each grid point:
| [Total mass density (kg/m3)
| [Total mass density (kg/m3),
| N2 # density (m-3),
| O2 # density (m-3),
| O # density (m-3),
Expand Down Expand Up @@ -266,9 +265,9 @@ def create_input(
lons: npt.ArrayLike,
lats: npt.ArrayLike,
alts: npt.ArrayLike,
f107s: Optional[npt.ArrayLike] = None,
f107as: Optional[npt.ArrayLike] = None,
aps: Optional[npt.ArrayLike] = None,
f107s: npt.ArrayLike | None = None,
f107as: npt.ArrayLike | None = None,
aps: npt.ArrayLike | None = None,
) -> tuple[tuple, npt.NDArray]:
"""
Combine all input values into a single flattened array.
Expand Down
3 changes: 1 addition & 2 deletions pymsis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import warnings
from io import BytesIO
from pathlib import Path
from typing import Optional

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


def download_f107_ap() -> None:
Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
build-backend = "mesonpy"
requires = [
"meson-python>=0.10.0",
"numpy>=2.0.0rc1",
"numpy>=2",
]

[project]
name = "pymsis"
version = "0.9.0"
version = "0.10.0"
description = "A Python wrapper around the NRLMSIS model."
readme = "README.md"
license = {file = "LICENSE"}
Expand All @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Operating System :: Microsoft :: Windows",
Expand All @@ -39,7 +40,7 @@ tests = [
]
docs = [
"matplotlib",
"sphinx<6",
"sphinx",
"sphinx_gallery",
"pydata-sphinx-theme",
]
Expand All @@ -64,11 +65,14 @@ addopts = [
]

[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-* cp313-*"
# skip 32 bit windows and linux builds for lack of numpy wheels
skip = "*-win32 *_i686"
test-requires = "pytest"
test-command = "pytest --pyargs pymsis"

[tool.ruff]
target-version = "py39"
target-version = "py310"
lint.select = ["B", "D", "E", "F", "I", "N", "S", "W", "PL", "PT", "UP", "RUF", "ANN"]
lint.ignore = ["B028", "D203", "D212", "PLR0913", "S310"]

Expand Down
10 changes: 5 additions & 5 deletions tests/test_msis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pymsis import msis, msis00f, msis20f, msis21f


@pytest.fixture()
@pytest.fixture
def input_data():
date = np.datetime64("2010-01-01T12:00")
lon = 0
Expand All @@ -17,12 +17,12 @@ def input_data():
return (date, lon, lat, alt, f107, f107a, ap)


@pytest.fixture()
@pytest.fixture
def expected_input():
return [1.0, 86400 / 2, 0, 0, 200, 150, 150] + [3] * 7


@pytest.fixture()
@pytest.fixture
def expected_output():
return np.array(
[
Expand All @@ -42,7 +42,7 @@ def expected_output():
)


@pytest.fixture()
@pytest.fixture
def expected_output00():
return np.array(
[
Expand All @@ -62,7 +62,7 @@ def expected_output00():
)


@pytest.fixture()
@pytest.fixture
def input_auto_f107_ap():
return (
np.datetime64("2000-07-01T12:00"),
Expand Down
Loading