Skip to content
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
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
jobname:
type: string
docker:
- image: cimg/python:3.9
- image: cimg/python:3.10
environment:
TOXENV=<< parameters.jobname >>
steps:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
jobname:
type: string
docker:
- image: cimg/python:3.9
- image: cimg/python:3.10
environment:
TOXENV: << parameters.jobname >>
GIT_SSH_COMMAND: ssh -i ~/.ssh/id_rsa_bfaaefe38d95110b75c79252bafbe0fc
Expand Down Expand Up @@ -86,16 +86,16 @@ workflows:
matrix:
parameters:
jobname:
- "py39-test-image-mpl334-cov"
Comment thread
pllim marked this conversation as resolved.
- "py39-test-image-mpldev-cov"
- "py310-test-image-mpl334-cov"
- "py310-test-image-mpldev-cov"

- deploy-reference-images:
name: baseline-<< matrix.jobname >>
matrix:
parameters:
jobname:
- "py39-test-image-mpl334-cov"
- "py39-test-image-mpldev-cov"
- "py310-test-image-mpl334-cov"
- "py310-test-image-mpldev-cov"
requires:
- << matrix.jobname >>
filters:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_cron_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ jobs:
include:
- name: Bundling with pyinstaller
os: ubuntu-latest
python: 3.9
python: '3.10'
toxenv: pyinstaller

- name: Python 3.11 with all optional dependencies and pre-releases
- name: Python 3.12 with all optional dependencies and pre-releases
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-alldeps-predeps
python: '3.12'
toxenv: py312-test-alldeps-predeps
toxargs: -v
toxposargs: --remote-data=any

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci_cron_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
python: '3.11'
toxenv: py311-test-devdeps-noscipy

- name: Python 3.11 with dev version of infrastructure dependencies
- name: Python 3.12 with dev version of infrastructure dependencies
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-devinfra
python: '3.12'
toxenv: py312-test-devinfra

- name: Documentation link check
os: ubuntu-latest
Expand All @@ -68,7 +68,7 @@ jobs:
# This is sensitive to Python version.
- name: Run flynt to check string formatting
os: ubuntu-latest
python: '3.10'
python: '3.11'
toxenv: flynt

steps:
Expand Down Expand Up @@ -100,8 +100,8 @@ jobs:
# we include them just in the weekly cron. These also serve as a test
# of using system libraries and using pytest directly.

runs-on: ubuntu-20.04
name: Python 3.11
runs-on: ubuntu-latest
name: Python 3.12
Comment thread
pllim marked this conversation as resolved.
if: (github.repository == 'astropy/astropy' && (github.event_name == 'schedule' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))
env:
ARCH_ON_CI: ${{ matrix.arch }}
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ jobs:
envs: |
# NOTE: this coverage test is needed for tests and code that
# run only with minimal dependencies.
- name: Python 3.11 with minimal dependencies and full coverage
linux: py311-test-cov
- name: Python 3.12 with minimal dependencies and full coverage
linux: py312-test-cov
coverage: codecov

- name: Python 3.10 in Parallel with all optional dependencies
linux: py310-test-alldeps-fitsio
- name: Python 3.11 in Parallel with all optional dependencies
linux: py311-test-alldeps-fitsio
libraries:
apt:
- language-pack-fr
Expand All @@ -76,21 +76,21 @@ jobs:
toxargs: -v --develop
posargs: -n=4 --run-slow

- name: Python 3.9 with oldest supported version of all dependencies
linux: py39-test-oldestdeps-alldeps-cov-clocale
- name: Python 3.10 with oldest supported version of all dependencies
linux: py310-test-oldestdeps-alldeps-cov-clocale
posargs: --remote-data=astropy
coverage: codecov

- name: Python 3.10 with all optional dependencies (Windows)
windows: py310-test-alldeps
- name: Python 3.11 with all optional dependencies (Windows)
windows: py311-test-alldeps
posargs: --durations=50

- name: Python 3.10 with all optional dependencies (MacOS X)
macos: py310-test-alldeps
- name: Python 3.11 with all optional dependencies (MacOS X)
macos: py311-test-alldeps
posargs: --durations=50 --run-slow

- name: Python 3.9 Double test (Run tests twice)
linux: py39-test-double
- name: Python 3.10 Double test (Run tests twice)
linux: py310-test-double

allowed_failures:
needs: [initial_checks]
Expand All @@ -111,6 +111,6 @@ jobs:
posargs: --remote-data=any --verbose

# https://github.com/matplotlib/matplotlib/issues/26847
- name: (Allowed Failure) Python 3.11 with dev version of matplotlib
linux: py311-test-mpldev
- name: (Allowed Failure) Python 3.12 with dev version of matplotlib
linux: py312-test-mpldev
posargs: --verbose
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
uses: actions/setup-python@v5
if: matrix.language == 'cpp'
with:
python-version: 3.9
python-version: '3.10'

- name: Manual build
if: matrix.language == 'cpp'
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test_extras: test
test_command: pytest -p no:warnings --astropy-header -m "not hypothesis" -k "not test_data_out_of_range and not test_set_locale and not TestQuantityTyping" --pyargs astropy
targets: |
- cp39-manylinux_x86_64
- cp310-manylinux_x86_64

build_and_publish:
# This does the actual wheel building and publishing as part of the cron job
Expand Down Expand Up @@ -59,44 +59,37 @@ jobs:
targets: |
# Linux wheels

- cp39-manylinux_x86_64
- cp310-manylinux_x86_64
- cp311-manylinux_x86_64
- cp312-manylinux_x86_64

# Note that following wheels are not currently tested:

- cp39-manylinux_aarch64
- cp310-manylinux_aarch64
- cp311-manylinux_aarch64
- cp312-manylinux_aarch64

- cp39-musllinux_x86_64
- cp310-musllinux_x86_64
- cp311-musllinux_x86_64
- cp312-musllinux_x86_64

# MacOS X wheels - as noted in https://github.com/astropy/astropy/pull/12379 we deliberately
# do not build universal2 wheels.

- cp39*macosx_x86_64
- cp310*macosx_x86_64
- cp311*macosx_x86_64
- cp312*macosx_x86_64

- cp39*macosx_arm64
- cp310*macosx_arm64
- cp311*macosx_arm64
- cp312*macosx_arm64

# Windows wheels

- cp39*win32
- cp310*win32
- cp311*win32
- cp312*win32

- cp39*win_amd64
- cp310*win_amd64
- cp311*win_amd64
- cp312*win_amd64
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "mambaforge-4.10"
jobs:
Expand Down
3 changes: 3 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ lint.ignore = [
"TRY201", # verbose-raise
"TRY301", # raise-within-try

# pyupgrade (UP)
"UP038", # isinstance using union separators. The code is slower as of Python 3.10-3.12

# flake8-quotes (Q)
"Q000", # use double quotes
]
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ requirements for inclusion in the package:

**Code Quality**
* Are the [coding guidelines](https://docs.astropy.org/en/latest/development/codeguide.html) followed?
* Is the code compatible with Python >=3.8?
* Are there dependencies other than the `astropy` core, the Python Standard
Library, and NumPy 1.18.0 or later?
* Is the code compatible with the supported versions of Python (see [pyproject.toml](https://github.com/astropy/astropy/blob/main/pyproject.toml))?
* Are there dependencies other than the run-time dependencies listed in pyproject.toml?
* Is the package importable even if the C-extensions are not built?
* Are additional dependencies handled appropriately?
* Do functions that require additional dependencies raise an `ImportError`
Expand Down
2 changes: 1 addition & 1 deletion astropy/coordinates/earth.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_json_result(url, err_str, use_google):
)
raise NameResolveError(err_str.format(msg=msg)) from e

except socket.timeout:
except TimeoutError:
# There are some cases where urllib2 does not catch socket.timeout
# especially while receiving response data on an already previously
# working request
Expand Down
3 changes: 1 addition & 2 deletions astropy/coordinates/name_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# Standard library
import os
import re
import socket
import urllib.error
import urllib.parse
import urllib.request
Expand Down Expand Up @@ -180,7 +179,7 @@ def get_icrs_coordinates(name, parse=False, cache=False):
except urllib.error.URLError as e:
exceptions.append(e)
continue
except socket.timeout as e:
except TimeoutError as e:
# There are some cases where urllib2 does not catch socket.timeout
# especially while receiving response data on an already previously
# working request
Expand Down
2 changes: 1 addition & 1 deletion astropy/coordinates/sky_coordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)

if TYPE_CHECKING:
from typing import Callable
from collections.abc import Callable

__all__ = ["SkyCoord", "SkyCoordInfo"]

Expand Down
3 changes: 2 additions & 1 deletion astropy/coordinates/transformations/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import subprocess
from collections import defaultdict
from contextlib import contextmanager
from itertools import pairwise

from astropy.coordinates.transformations.affine import (
AffineTransform,
Expand Down Expand Up @@ -713,7 +714,7 @@ def _add_merged_transform(self, fromsys, tosys, *furthersys, priority=1):
full_path = self.get_transform(fromsys, lastsys)
transforms = [
self.get_transform(frame_a, frame_b)
for frame_a, frame_b in zip(frames[:-1], frames[1:])
for frame_a, frame_b in pairwise(frames)
]
if None in transforms:
raise ValueError("This transformation path is not possible")
Expand Down
15 changes: 9 additions & 6 deletions astropy/cosmology/funcs/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
import functools
import inspect
from dataclasses import dataclass
from typing import Any, Callable, Union
from typing import TYPE_CHECKING

import numpy as np
from numpy import False_, True_, ndarray

from astropy import table
from astropy.cosmology.core import Cosmology

if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any, TypeAlias

__all__: list[str] = [] # Nothing is scoped here


##############################################################################
# PARAMETERS

_FormatType = Union[bool, None, str]
_FormatsT = Union[_FormatType, tuple[_FormatType, ...]]
_CompFnT = Callable[[Any, _FormatType], Cosmology]
_FormatType: TypeAlias = bool | None | str
_FormatsType: TypeAlias = _FormatType | tuple[_FormatType, ...]

_COSMO_AOK: set[Any] = {None, True_, False_, "astropy.cosmology"}
# The numpy bool also catches real bool for ops "==" and "in"
Expand Down Expand Up @@ -110,7 +113,7 @@ def _parse_format(cosmo: Any, format: _FormatType, /) -> Cosmology:
return out


def _parse_formats(*cosmos: object, format: _FormatsT) -> ndarray:
def _parse_formats(*cosmos: object, format: _FormatsType) -> ndarray:
"""Parse Cosmology-like to |Cosmology|, using provided formats.

``format`` is broadcast to match the shape of the cosmology arguments. Note
Expand Down Expand Up @@ -183,7 +186,7 @@ def _comparison_decorator(pyfunc: Callable[..., Any]) -> Callable[..., Any]:

# Make wrapper function that parses cosmology-like inputs
@functools.wraps(pyfunc)
def wrapper(*cosmos: Any, format: _FormatsT = False, **kwargs: Any) -> bool:
def wrapper(*cosmos: Any, format: _FormatsType = False, **kwargs: Any) -> bool:
if len(cosmos) > nin:
raise TypeError(
f"{wrapper.__wrapped__.__name__} takes {nin} positional"
Expand Down
3 changes: 2 additions & 1 deletion astropy/cosmology/parameter/_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import Any, Callable
from collections.abc import Callable
from typing import Any

import astropy.units as u

Expand Down
Loading