Skip to content

Commit fc558ac

Browse files
Test py311 and support pydantic 2.0 and above (#97)
Co-authored-by: Daniel Garcia Briseno <[email protected]>
1 parent 69e589a commit fc558ac

26 files changed

+149
-112
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,24 @@ jobs:
2424
with:
2525
submodules: false
2626
coverage: codecov
27-
toxdeps: "'tox<4' tox-pypi-filter"
27+
toxdeps: tox-pypi-filter
2828
envs: |
29-
- linux: py310
29+
- linux: py311
3030
- linux: codestyle
3131
test:
3232
needs: [core]
3333
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
3434
with:
3535
submodules: false
3636
coverage: codecov
37-
toxdeps: "'tox<4' tox-pypi-filter"
37+
toxdeps: tox-pypi-filter
3838
libraries: |
3939
apt:
4040
- libopenjp2-7
4141
- graphviz
4242
envs: |
43-
- macos: py38
43+
- linux: py38
44+
- macos: py310
4445
- windows: py39
4546
- linux: build_docs
4647
publish:

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
repos:
22
- repo: https://github.com/myint/docformatter
3-
rev: v1.5.0
3+
rev: v1.7.4
44
hooks:
55
- id: docformatter
66
args: [--in-place, --pre-summary-newline, --make-summary-multi]
77
- repo: https://github.com/myint/autoflake
8-
rev: v2.0.0
8+
rev: v2.2.0
99
hooks:
1010
- id: autoflake
1111
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
1212
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py)$"
1313
- repo: https://github.com/psf/black
14-
rev: 22.10.0
14+
rev: 23.3.0
1515
hooks:
1616
- id: black
1717
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
@@ -34,7 +34,7 @@ repos:
3434
- id: check-yaml
3535
- id: debug-statements
3636
- repo: https://github.com/pre-commit/mirrors-mypy
37-
rev: 'v0.991'
37+
rev: 'v1.4.1'
3838
hooks:
3939
- id: mypy
4040
additional_dependencies: [types-requests==2.28.0]

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
build:
33
os: ubuntu-20.04
44
tools:
5-
python: "3.9"
5+
python: "3.11"
66
apt_packages:
77
- libopenjp2-7
88
- graphviz

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 2-Clause License
22

3-
Copyright (c) 2022, Helioviewer Project
3+
Copyright (c) 2022-2023, Helioviewer Project
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

docs/conf.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,8 @@
4444
# -- Options for intersphinx extension -----------------------------------------
4545
intersphinx_mapping = {
4646
"python": ("https://docs.python.org/3/", None),
47-
"numpy": ("https://numpy.org/doc/stable/", None),
48-
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
49-
"matplotlib": ("https://matplotlib.org/stable", None),
50-
"aiapy": ("https://aiapy.readthedocs.io/en/stable/", None),
51-
"astropy": ("https://docs.astropy.org/en/stable/", None),
5247
"requests": ("https://requests.readthedocs.io/en/stable/", None),
48+
"pydantic": ("https://docs.pydantic.dev/latest/", None),
5349
}
5450

5551
# -- Options for HTML output ---------------------------------------------------

hvpy/api_groups/jpeg2000/get_jp2_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Union
22
from datetime import datetime
33

4-
from pydantic import Field, validator
4+
from pydantic import Field, field_validator
55

66
from hvpy.datasource import DataSource
77
from hvpy.io import HvpyParameters, OutputType
@@ -37,8 +37,8 @@ class getJP2ImageInputParameters(HvpyParameters):
3737
sourceId: Union[int, DataSource]
3838
jpip: bool = False
3939
Json: bool = Field(False, alias="json")
40-
_date_validator = validator("date", allow_reuse=True)(convert_date_to_isoformat)
41-
_source_id_validator = validator("sourceId", allow_reuse=True)(_data_source_to_int)
40+
_date_validator = field_validator("date")(convert_date_to_isoformat)
41+
_source_id_validator = field_validator("sourceId")(_data_source_to_int)
4242

4343
def get_output_type(self) -> OutputType:
4444
"""

hvpy/api_groups/jpeg2000/get_jpx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Union, Optional
22
from datetime import datetime
33

4-
from pydantic import validator
4+
from pydantic import field_validator
55

66
from hvpy.datasource import DataSource
77
from hvpy.io import HvpyParameters, OutputType
@@ -50,8 +50,8 @@ class getJPXInputParameters(HvpyParameters):
5050
verbose: bool = False
5151
jpip: bool = False
5252
cadence: Optional[int] = None
53-
_date_validator = validator("startTime", "endTime", allow_reuse=True)(convert_date_to_isoformat)
54-
_source_id_validator = validator("sourceId", allow_reuse=True)(_data_source_to_int)
53+
_date_validator = field_validator("startTime", "endTime")(convert_date_to_isoformat)
54+
_source_id_validator = field_validator("sourceId")(_data_source_to_int)
5555

5656
def get_output_type(self) -> OutputType:
5757
"""

hvpy/api_groups/jpeg2000/get_jpx_closest_to_mid_point.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import List, Union
22
from datetime import datetime
33

4-
from pydantic import validator
4+
from pydantic import field_validator
55

66
from hvpy.datasource import DataSource
77
from hvpy.io import HvpyParameters, OutputType
@@ -44,8 +44,8 @@ class getJPXClosestToMidPointInputParameters(HvpyParameters):
4444
linked: bool = True
4545
verbose: bool = False
4646
jpip: bool = False
47-
_date_validator = validator("startTimes", "endTimes", allow_reuse=True)(convert_date_to_unix)
48-
_source_id_validator = validator("sourceId", allow_reuse=True)(_data_source_to_int)
47+
_date_validator = field_validator("startTimes", "endTimes")(convert_date_to_unix)
48+
_source_id_validator = field_validator("sourceId")(_data_source_to_int)
4949

5050
def get_output_type(self) -> OutputType:
5151
"""

hvpy/api_groups/jpeg2000/tests/test_get_jp2_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
def test_str_response(date):
99
response = getJP2Image(date=date, sourceId=DataSource.AIA_335, jpip=True, json=False)
1010
assert isinstance(response, str)
11-
assert response.startswith("jpip://")
11+
assert response.startswith("jpips://")
1212

1313

1414
def test_json_response(date):
1515
response = getJP2Image(date=date, sourceId=14, jpip=True, json=True)
1616
assert isinstance(response, dict)
1717
assert "uri" in response
18-
assert response["uri"].startswith("jpip://")
18+
assert response["uri"].startswith("jpips://")
1919

2020

2121
def test_raw_response(date):

0 commit comments

Comments
 (0)