Skip to content

gh-198: enforce python>3.8 & numpy>1.21 #326

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

Merged
merged 3 commits into from
Oct 4, 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
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
Expand Down Expand Up @@ -67,7 +66,7 @@ jobs:
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: run-3.8,run-3.9,run-3.10,run-3.11,run-3.12
carryforward: run-3.9,run-3.10,run-3.11,run-3.12

build:
name: Build
Expand Down
9 changes: 4 additions & 5 deletions glass/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@
from __future__ import annotations

import warnings

# typing
from typing import Any, Callable, Generator, Iterable, Optional, Sequence, Tuple, Union
from collections.abc import Generator, Iterable, Sequence
from typing import Any, Callable, Optional, Union

import healpy as hp
import numpy as np
import numpy.typing as npt
from gaussiancl import gaussiancl

# types
Size = Optional[Union[int, Tuple[int, ...]]]
Iternorm = Tuple[Optional[int], npt.NDArray, npt.NDArray]
Size = Optional[Union[int, tuple[int, ...]]]
Iternorm = tuple[Optional[int], npt.NDArray, npt.NDArray]
ClTransform = Union[str, Callable[[npt.NDArray], npt.NDArray]]
Cls = Sequence[Union[npt.NDArray, Sequence[float]]]
Alms = npt.NDArray
Expand Down
6 changes: 3 additions & 3 deletions glass/lensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

from __future__ import annotations

# typing support
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING

import healpy as hp
import numpy as np

if TYPE_CHECKING:
# to prevent circular dependencies, only import these for type checking
from collections.abc import Sequence

import numpy.typing as npt

from cosmology import Cosmology
Expand Down
6 changes: 2 additions & 4 deletions glass/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@
from __future__ import annotations

import warnings

# type checking
from typing import TYPE_CHECKING, Callable, NamedTuple, Sequence, Union
from collections.abc import Sequence
from typing import TYPE_CHECKING, Callable, NamedTuple, Union

import numpy as np
import numpy.typing as npt
Expand All @@ -57,7 +56,6 @@
if TYPE_CHECKING:
from cosmology import Cosmology


# types
ArrayLike1D = Union[Sequence[float], npt.NDArray]
WeightFunc = Callable[[ArrayLike1D], npt.NDArray]
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint", "tests"]

ALL_PYTHON = ["3.8", "3.9", "3.10", "3.11", "3.12"]
ALL_PYTHON = ["3.9", "3.10", "3.11", "3.12"]


@nox.session
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -24,7 +23,7 @@ dependencies = [
"gaussiancl>=2022.10.21",
"healpix>=2022.11.1",
"healpy>=1.15.0",
"numpy>=1.20.0",
"numpy>=1.22.0",
]
description = "Generator for Large Scale Structure"
dynamic = [
Expand All @@ -35,7 +34,7 @@ maintainers = [
]
name = "glass"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license.file = "LICENSE"

[project.optional-dependencies]
Expand Down
14 changes: 8 additions & 6 deletions tests/test_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ def test_basic_write(tmp_path):
filename_gfits = "gfits.fits" # what GLASS creates
filename_tfits = "tfits.fits" # file created on the fly to test against

with user.write_catalog(
tmp_path / filename_gfits, ext="CATALOG"
) as out, fitsio.FITS(tmp_path / filename_tfits, "rw", clobber=True) as my_fits:
with (
user.write_catalog(tmp_path / filename_gfits, ext="CATALOG") as out,
fitsio.FITS(tmp_path / filename_tfits, "rw", clobber=True) as my_fits,
):
for i in range(my_max):
array = np.arange(i, i + 1, delta) # array of size 1/delta
array2 = np.arange(i + 1, i + 2, delta) # array of size 1/delta
Expand All @@ -43,9 +44,10 @@ def test_basic_write(tmp_path):
names = ["RA", "RB"]
_test_append(my_fits, arrays, names)

with fitsio.FITS(tmp_path / filename_gfits) as g_fits, fitsio.FITS(
tmp_path / filename_tfits
) as t_fits:
with (
fitsio.FITS(tmp_path / filename_gfits) as g_fits,
fitsio.FITS(tmp_path / filename_tfits) as t_fits,
):
glass_data = g_fits[1].read()
test_data = t_fits[1].read()
assert glass_data["RA"].size == test_data["RA"].size
Expand Down