Skip to content
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

fix tests to allow for variable STAC versions in output #73

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mishaschwartz
Copy link
Contributor

@mishaschwartz mishaschwartz commented Feb 7, 2025

Tests currently assume that the STAC version in item and collection JSONs will always be 1.0.0.
Since we don't pin a specific version of pystac, a new version of pystac uses STAC version 1.1.0 which now causes tests to fail.

This PR updates tests to allow for item and collection JSONs to have a stac_version field that matches the version used by the installed version of pystac.

As part of this PR, I also updated the dependency versions to not allow major version upgrades automatically. For example, pystac is now pinned to version ~=1.12 which will mean is will not install version 2+. This should avoid similar breaking changes caused by dependency updates in the future.

Copy link
Collaborator

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without some kind of dependapot checking packages regularly, I'm expecting maintenance creep and vulnerabilities in the long run.

For example, requests and lxml are regularly updated to resolve security issues. I somewhat like the fact that those are auto-bumped to latest version. The "pinned" versions, if needed, are available in the docker.

Note also that limiting MAJOR is not really a fix, just as in the case of pystac. It is a seemingly "MINOR" update that broke the tests by changing STAC version entirely.

@@ -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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems problematic IMO.

There are different properties (eg: new bands) in STAC 1.1 for which stac_version should not be blindly "overridden", but actually migrated.

If there was an error when using pystac within stac-populator, I'd argue this is probably a mishandling somewhere which should be addressed. I find this test properly early-detected an issue that must be investigated further, since pystac is supposed to support both versions, and do appropriate migrations as needed.

Are we not simply ignoring a potential issue if the catalog targeted by stac-populator still uses STAC 1.0? We cannot just push a STAC 1.1 to it, and the populator code should adapt to this (if needed).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/stac-utils/pystac/blob/main/CHANGELOG.md#v1121

Maybe we should have migrate=False explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not simply ignoring a potential issue if the catalog targeted by stac-populator still uses STAC 1.0? We cannot just push a STAC 1.1 to it, and the populator code should adapt to this (if needed).

I don't think that is what this is testing. This does not try to upload any data to an existing STAC server so it doesn't have any information from a server to know what version it is running.

We should definitely add a test that checks for that but that should be additional to this one.

There are different properties (eg: new bands) in STAC 1.1 for which stac_version should not be blindly "overridden", but actually migrated.

I'll update this test to ensure that any migrations beyond just the "stac_version" between versions are being tested as well.

@mishaschwartz
Copy link
Contributor Author

Without some kind of dependapot checking packages regularly, I'm expecting maintenance creep and vulnerabilities in the long run.

Ok let's add a dependabot

For example, requests and lxml are regularly updated to resolve security issues. I somewhat like the fact that those are auto-bumped to latest version. The "pinned" versions, if needed, are available in the docker.

We're not just developing a docker image though, this is also usable as a package and dependency versions should be managed properly so they don't break things for other users.

Note also that limiting MAJOR is not really a fix, just as in the case of pystac. It is a seemingly "MINOR" update that broke the tests by changing STAC version entirely.

Ok so we'll keep pystac more limited. Good to know.

@mishaschwartz
Copy link
Contributor Author

Without some kind of dependapot checking packages regularly, I'm expecting maintenance creep and vulnerabilities in the long run.

Ok let's add a dependabot

FYI I don't have sufficient permissions to enable dependabot for this repo. If you have permissions @huard or @fmigneault please feel free to set it up.

@fmigneault fmigneault mentioned this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants