Skip to content

Commit a8b8fd6

Browse files
Merge branch 'develop' into pre-commit-ci-update-config
2 parents 3d4cfa5 + 36c6fd4 commit a8b8fd6

15 files changed

Lines changed: 85 additions & 106 deletions

.github/workflows/build-pipeline.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
1111

12+
env:
13+
POETRY_VERSION: "2.1.3"
14+
PYTHON_VERSION: "3.10"
15+
1216
jobs:
1317
run_tests:
1418
uses: ./.github/workflows/reusable_run_tests.yml
@@ -24,12 +28,13 @@ jobs:
2428

2529
- uses: actions/setup-python@v5
2630
with:
27-
python-version: 3.9
31+
python-version: ${{ env.PYTHON_VERSION }}
32+
2833

2934
- name: Install Poetry
3035
uses: abatilo/actions-poetry@v4.0.0
3136
with:
32-
poetry-version: 1.3.2
37+
poetry-version: ${{ env.POETRY_VERSION }}
3338

3439
- name: Get version
3540
id: get-version

.github/workflows/release_created.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ name: Release Branch Created
44
on:
55
create
66

7+
env:
8+
POETRY_VERSION: "2.1.3"
9+
PYTHON_VERSION: "3.10"
10+
711
jobs:
812
# First job in the workflow builds and verifies the software artifacts
913
bump:
@@ -20,11 +24,11 @@ jobs:
2024
ref: 'refs/heads/develop'
2125
- uses: actions/setup-python@v5
2226
with:
23-
python-version: 3.9
27+
python-version: ${{ env.PYTHON_VERSION }}
2428
- name: Install Poetry
2529
uses: abatilo/actions-poetry@v4.0.0
2630
with:
27-
poetry-version: 1.3.2
31+
poetry-version: ${{ env.POETRY_VERSION }}
2832
- name: Bump minor version
2933
run: |
3034
poetry version ${GITHUB_REF#refs/heads/release/}

.github/workflows/reusable_run_tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ on:
1212
required: true
1313
workflow_dispatch:
1414

15+
env:
16+
POETRY_VERSION: "2.1.3"
17+
1518
jobs:
1619
build_and_test:
1720
runs-on: ubuntu-latest
1821
strategy:
1922
matrix:
20-
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
23+
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
2124

2225
name: Python ${{ matrix.python-version }} tests
2326
steps:
@@ -33,7 +36,7 @@ jobs:
3336
- name: Set up Poetry
3437
uses: abatilo/actions-poetry@v4.0.0
3538
with:
36-
poetry-version: 1.3.2
39+
poetry-version: ${{ env.POETRY_VERSION }}
3740

3841
- name: Install ncompare
3942
run: poetry install

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ci:
55
autofix_prs: false # Comment "pre-commit.ci autofix" on a PR to trigger
66

77
default_language_version:
8-
python: python3.9
8+
python: python3.10
99

1010
repos:
1111
- repo: https://github.com/gitleaks/gitleaks

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Common Changelog](https://common-changelog.org/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
### Changed
10+
11+
- update the default python version from 3.9 to 3.10 ([#323](https://github.com/nasa/stitchee/pull/323))([**@danielfromearth**](https://github.com/danielfromearth))
12+
713
## [1.13.1] - 2025-01-08
814

915
### Fixed
@@ -242,3 +248,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
242248
### Fixed
243249

244250
- Fix author attribute for poetry [#5](https://github.com/nasa/ncompare/issues/5) ([**@danielfromearth**](https://github.com/danielfromearth))
251+
252+
[1.13.1]: https://github.com/nasa/ncompare/releases/tag/1.13.1
253+
[1.13.0]: https://github.com/nasa/ncompare/releases/tag/1.13.0
254+
[1.12.0]: https://github.com/nasa/ncompare/releases/tag/1.12.0
255+
[1.11.0]: https://github.com/nasa/ncompare/releases/tag/1.11.0
256+
[1.10.0]: https://github.com/nasa/ncompare/releases/tag/1.10.0
257+
[1.9.0]: https://github.com/nasa/ncompare/releases/tag/1.9.0
258+
[1.8.0]: https://github.com/nasa/ncompare/releases/tag/1.8.0
259+
[1.7.3]: https://github.com/nasa/ncompare/releases/tag/1.7.3
260+
[1.7.2]: https://github.com/nasa/ncompare/releases/tag/1.7.2
261+
[1.7.1]: https://github.com/nasa/ncompare/releases/tag/1.7.1
262+
[1.7.0]: https://github.com/nasa/ncompare/releases/tag/1.7.0
263+
[1.6.2]: https://github.com/nasa/ncompare/releases/tag/1.6.2
264+
[1.6.1]: https://github.com/nasa/ncompare/releases/tag/1.6.1
265+
[1.6.0]: https://github.com/nasa/ncompare/releases/tag/1.6.0
266+
[1.5.0]: https://github.com/nasa/ncompare/releases/tag/1.5.0
267+
[1.4.0]: https://github.com/nasa/ncompare/releases/tag/1.4.0
268+
[1.3.0]: https://github.com/nasa/ncompare/releases/tag/1.3.0
269+
[1.2.0]: https://github.com/nasa/ncompare/releases/tag/1.2.1
270+
[1.1.0]: https://github.com/nasa/ncompare/releases/tag/1.1.0
271+
[1.0.2]: https://github.com/nasa/ncompare/releases/tag/1.1.0
272+
[1.0.1]: https://github.com/nasa/ncompare/releases/tag/1.0.0

ncompare/Comparison.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from collections.abc import Iterator
2-
from typing import Union
32

43
import h5py
54
import netCDF4
@@ -138,9 +137,9 @@ def _traverse_hierarchy(self):
138137

139138
def _print_group_details_side_by_side(
140139
self,
141-
group_a: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group],
140+
group_a: netCDF4.Dataset | netCDF4.Group | h5py.Group,
142141
group_a_name: str,
143-
group_b: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group],
142+
group_b: netCDF4.Dataset | netCDF4.Group | h5py.Group,
144143
group_b_name: str,
145144
group_counter: int,
146145
) -> None:
@@ -158,8 +157,8 @@ def _print_group_details_side_by_side(
158157
)
159158

160159
# Count the number of variables in this group as long as this group exists.
161-
vars_a_sorted: Union[list, str] = ""
162-
vars_b_sorted: Union[list, str] = ""
160+
vars_a_sorted: list | str = ""
161+
vars_b_sorted: list | str = ""
163162
if group_a:
164163
vars_a_sorted = get_variables(group_a, self.file_types)
165164
if group_b:
@@ -324,10 +323,10 @@ def __print_summary_count_comparison_side_by_side(
324323
def _dataset_pair_iterator(
325324
self,
326325
node_a_name: str,
327-
node_a: Union[netCDF4.Dataset, netCDF4.Group, h5py.Dataset, h5py.Group],
326+
node_a: netCDF4.Dataset | netCDF4.Group | h5py.Dataset | h5py.Group,
328327
node_a_subgroups: list,
329328
node_b_name: str,
330-
node_b: Union[netCDF4.Dataset, netCDF4.Group, h5py.Dataset, h5py.Group],
329+
node_b: netCDF4.Dataset | netCDF4.Group | h5py.Dataset | h5py.Group,
331330
node_b_subgroups: list,
332331
) -> Iterator[GroupPair]:
333332
"""Yield names and groups, as pairs, from two netCDF or HDF hierarchies.
@@ -401,7 +400,7 @@ def _dataset_pair_iterator(
401400
)
402401

403402
def _create_var_properties(
404-
self, group: Union[netCDF4.Dataset, netCDF4.Group], varname: str, original_dataset
403+
self, group: netCDF4.Dataset | netCDF4.Group, varname: str, original_dataset
405404
) -> VarProperties:
406405
"""Get the properties of a variable.
407406

ncompare/console.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@
3131
import sys
3232
import traceback
3333
from collections.abc import Sequence
34-
from typing import Optional
3534

3635
from ncompare.core import compare
3736

3837
__version__ = importlib.metadata.version("ncompare")
3938

4039

41-
def _cli(args: Optional[Sequence[str]]) -> argparse.Namespace:
40+
def _cli(args: Sequence[str] | None) -> argparse.Namespace:
4241
"""Parse input arguments from the command line.
4342
4443
Parameters

ncompare/core.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"""Compare the structure of two netCDF or HDF files."""
3131

3232
from pathlib import Path
33-
from typing import Optional, Union
3433

3534
from ncompare.Comparison import Comparison
3635
from ncompare.path_and_string_operations import (
@@ -42,16 +41,16 @@
4241

4342

4443
def compare(
45-
path_a: Union[str, Path],
46-
path_b: Union[str, Path],
44+
path_a: str | Path,
45+
path_b: str | Path,
4746
only_diffs: bool = False,
4847
no_color: bool = False,
4948
show_chunks: bool = False,
5049
show_attributes: bool = False,
51-
file_text: Union[str, Path] = "",
52-
file_csv: Union[str, Path] = "",
53-
file_xlsx: Union[str, Path] = "",
54-
column_widths: Optional[tuple[Union[int, str], Union[int, str], Union[int, str]]] = None,
50+
file_text: str | Path = "",
51+
file_csv: str | Path = "",
52+
file_xlsx: str | Path = "",
53+
column_widths: tuple[int | str, int | str, int | str] | None = None,
5554
) -> int:
5655
"""Compare the variables contained within two netCDF or HDF files.
5756

ncompare/getters.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import warnings
22
from collections.abc import Iterable, Iterator
3-
from typing import Union
43

54
import h5py
65
import netCDF4
@@ -12,7 +11,7 @@
1211

1312
def get_and_check_variable_scale_factor(
1413
v_a: VarProperties, v_b: VarProperties
15-
) -> Union[None, tuple[str, str]]:
14+
) -> None | tuple[str, str]:
1615
"""Get a string representation of the scale factor for two variables."""
1716
sf_a = getattr(v_a.variable, "scale_factor", " ")
1817
sf_b = getattr(v_b.variable, "scale_factor", " ")
@@ -68,7 +67,7 @@ def get_root_groups(file: FileToCompare) -> list:
6867
return groups_list
6968

7069

71-
def get_subgroups(node: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group], file_type: str) -> list:
70+
def get_subgroups(node: netCDF4.Dataset | netCDF4.Group | h5py.Group, file_type: str) -> list:
7271
"""Get a list of subgroups from a netCDF or HDF5 group.
7372
7473
Parameters
@@ -89,7 +88,7 @@ def get_subgroups(node: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group], file_
8988
return list(node.groups)
9089

9190

92-
def get_variables(node: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group], file_type: str) -> list:
91+
def get_variables(node: netCDF4.Dataset | netCDF4.Group | h5py.Group, file_type: str) -> list:
9392
"""Get a sorted list of variables from a netCDF or HDF5 group."""
9493
if file_type == "hdf5":
9594
return [key for key in node.keys() if isinstance(node[key], h5py.Dataset)]

ncompare/path_and_string_operations.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,26 @@
2626
"""Helper utilities."""
2727

2828
from pathlib import Path
29-
from typing import Union
3029

3130
from ncompare.utility_types import FileToCompare, valid_file_type_ids
3231

3332

34-
def ensure_valid_path_exists(should_be_path: Union[str, Path]) -> Path:
33+
def ensure_valid_path_exists(should_be_path: str | Path) -> Path:
3534
"""Coerce input to a pathlib.Path and check that the resulting filepath exists."""
3635
path_obj = Path(should_be_path)
3736
if path_obj.exists():
3837
return path_obj
3938
raise FileNotFoundError(f"Expected file does not exist: {should_be_path}")
4039

4140

42-
def ensure_valid_path_with_suffix(should_be_path: Union[str, Path], suffix: str) -> Path:
41+
def ensure_valid_path_with_suffix(should_be_path: str | Path, suffix: str) -> Path:
4342
"""Coerce input to a pathlib.Path with given suffix."""
4443
if not suffix.startswith("."):
4544
raise ValueError(f"Invalid suffix: {suffix}. It must start with '.'")
4645
return Path(should_be_path).with_suffix(suffix)
4746

4847

49-
def coerce_to_str(some_object: Union[str, int, tuple]) -> str:
48+
def coerce_to_str(some_object: str | int | tuple) -> str:
5049
"""Ensure the type is a string."""
5150
if isinstance(some_object, (str, int, tuple)):
5251
return str(some_object)

0 commit comments

Comments
 (0)