From 1509db50e48ccf76f6f2e50cae6f65f7e11d7f1c Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Fri, 7 Feb 2025 10:54:12 -0500 Subject: [PATCH 1/3] fix tests --- CHANGES.md | 3 ++- pyproject.toml | 33 +++++++++++++++--------------- tests/test_standalone_stac_item.py | 3 +++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 030f7b8..c383106 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,7 +20,8 @@ * move argument parsing for logging options to the implementation code * fix bug where logging options were being set incorrectly * rename files to avoid potential naming conflicts with other packages (`logging` and `requests`) - +* enforce versions for dependencies so that new installs won't fail unexpectedly +* update tests to allow for a variable `stac_version` field in STAC item and collections ## [0.6.0](https://github.com/crim-ca/stac-populator/tree/0.6.0) (2024-02-22) diff --git a/pyproject.toml b/pyproject.toml index e3f5b34..d604062 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,15 +105,15 @@ version = "0.6.0" description = "Utility to populate STAC Catalog, Collections and Items from various dataset/catalog sources." requires-python = ">=3.10" dependencies = [ - "colorlog", - "pyyaml", - "siphon", - "pystac", - "xncml>=0.3.1", # python 3.12 support - "pydantic>=2", - "pyessv", - "requests", - "lxml", + "colorlog~=6.9", + "pyyaml~=6.0", + "siphon~=0.10", + "pystac~=1.12", + "xncml~=0.3", # python 3.12 support + "pydantic~=2.10", + "pyessv~=0.9", + "requests~=2.32", + "lxml~=5.3", ] readme = "README.md" license = { file = "LICENSE" } @@ -162,12 +162,11 @@ Changelog = "https://github.com/crim-ca/stac-populator/blob/master/CHANGES.md" [project.optional-dependencies] dev = [ - "pytest", - "pytest-cov", - "coverage", - "responses", - "bump-my-version", - "jsonschema", - "pystac[validation]>=1.9.0" + "pytest~=8.3", + "pytest-cov~=6.0", + "coverage~=7.6", + "responses~=0.25", + "bump-my-version~=0.32", + "jsonschema~=4.23", + "pystac[validation]~=1.12" ] - diff --git a/tests/test_standalone_stac_item.py b/tests/test_standalone_stac_item.py index 82de64e..a883b85 100644 --- a/tests/test_standalone_stac_item.py +++ b/tests/test_standalone_stac_item.py @@ -6,6 +6,7 @@ from urllib.parse import quote import xncml +from pystac.version import get_stac_version from STACpopulator.extensions.cmip6 import CMIP6Helper from STACpopulator.extensions.thredds import THREDDSHelper, THREDDSExtension @@ -50,6 +51,7 @@ def test_standalone_stac_item_thredds_ncml(): ref_file = os.path.join(CUR_DIR, "data/stac_item_testdata_xclim_cmip6_ncml.json") with open(ref_file, mode="r", encoding="utf-8") as ff: reference = json.load(ff) + reference["stac_version"] = get_stac_version() assert stac_item.to_dict() == reference @@ -86,5 +88,6 @@ def test_cmip6_stac_thredds_catalog_parsing(): ref_file = os.path.join(CUR_DIR, "data/stac_collection_testdata_xclim_cmip6_catalog.json") with open(ref_file, mode="r", encoding="utf-8") as ff: reference = json.load(ff) + reference["stac_version"] = get_stac_version() assert result == reference From a2608a57a978083d50b4fd825baa89c4a3a817c6 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Wed, 12 Feb 2025 10:00:29 -0500 Subject: [PATCH 2/3] handle stac migrations more reliably in tests and pin pystac to minor version --- pyproject.toml | 4 ++-- tests/test_standalone_stac_item.py | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d604062..4f460b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,7 +108,7 @@ dependencies = [ "colorlog~=6.9", "pyyaml~=6.0", "siphon~=0.10", - "pystac~=1.12", + "pystac~=1.12.1", "xncml~=0.3", # python 3.12 support "pydantic~=2.10", "pyessv~=0.9", @@ -168,5 +168,5 @@ dev = [ "responses~=0.25", "bump-my-version~=0.32", "jsonschema~=4.23", - "pystac[validation]~=1.12" + "pystac[validation]~=1.12.1" ] diff --git a/tests/test_standalone_stac_item.py b/tests/test_standalone_stac_item.py index a883b85..72b7343 100644 --- a/tests/test_standalone_stac_item.py +++ b/tests/test_standalone_stac_item.py @@ -1,4 +1,5 @@ import json +import pystac import pytest import requests import os @@ -6,7 +7,6 @@ from urllib.parse import quote import xncml -from pystac.version import get_stac_version from STACpopulator.extensions.cmip6 import CMIP6Helper from STACpopulator.extensions.thredds import THREDDSHelper, THREDDSExtension @@ -50,8 +50,7 @@ def test_standalone_stac_item_thredds_ncml(): ref_file = os.path.join(CUR_DIR, "data/stac_item_testdata_xclim_cmip6_ncml.json") with open(ref_file, mode="r", encoding="utf-8") as ff: - reference = json.load(ff) - reference["stac_version"] = get_stac_version() + reference = pystac.Item.from_dict(json.load(ff)).to_dict() assert stac_item.to_dict() == reference @@ -87,7 +86,6 @@ def test_cmip6_stac_thredds_catalog_parsing(): ref_file = os.path.join(CUR_DIR, "data/stac_collection_testdata_xclim_cmip6_catalog.json") with open(ref_file, mode="r", encoding="utf-8") as ff: - reference = json.load(ff) - reference["stac_version"] = get_stac_version() + reference = pystac.Collection.from_dict(json.load(ff)).to_dict() assert result == reference From b29e034ae3ecbea52710d5d45178c8fabe1bb216 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:47:58 -0500 Subject: [PATCH 3/3] fix dependabot file --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5870d41 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly"