pangeo-data / pangeo-datastore-stac

STAC implementation of Pangeo Catalog
3 stars 0 forks source link

Add CI? #1

Open rabernat opened 4 years ago

rabernat commented 4 years ago

Fantastic work Charles! This is really a great start!

You may want to consider adding a github action to run the STAC validator on the catalog. I know it won't validate yet, but this will help in the future.

charlesbluca commented 4 years ago

I agree -- once I am done drafting out a README for the repo I will work on adding a workflow for PRs and pushes to master.

charlesbluca commented 4 years ago

I'm not sure if this is just a personal issue, but the STAC validator doesn't seem to be fetching the specifications properly:

>> stac_validator https://raw.githubusercontent.com/charlesbluca/pangeo-datastore-stac/master/master/catalog.json

Traceback (most recent call last):
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\stac_validator\stac_validator.py", line 125, in fetch_spec
    spec = requests.get(url(self.stac_version)).json()
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\geniu\Miniconda3\envs\pangeo-stac-test\Scripts\stac_validator.exe\__main__.py", line 7, in <module>
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\stac_validator\stac_validator.py", line 423, in main
    _ = stac.run(nthreads)
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\stac_validator\stac_validator.py", line 397, in run
    message, status, new_children = task.result()
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\concurrent\futures\_base.py", line 425, in result
    return self.__get_result()
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\concurrent\futures\thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\stac_validator\stac_validator.py", line 326, in _validate
    is_valid_stac, err_message = self.validate_json(stac_content, self.fetch_spec("catalog"))
  File "c:\users\geniu\miniconda3\envs\pangeo-stac-test\lib\site-packages\stac_validator\stac_validator.py", line 129, in fetch_spec
    raise VersionException(f"Could not download STAC specification files for version: {self.stac_version}")
stac_validator.stac_validator.VersionException: Could not download STAC specification files for version: master

It looks like the source code for the validator hasn't been updated in nearly a year, so we may have to push for some updates to be made before it is useful for testing. In the meantime, could you check if the follow works for you?

pip install stac_validator
stac_validator https://raw.githubusercontent.com/charlesbluca/pangeo-datastore-stac/master/master/catalog.json
rabernat commented 4 years ago

I would ping @m-mohr on this. He has been very helpful in the past.

m-mohr commented 4 years ago

STAC Validator is a bit outdated unfortunately, I'm not sure it supports the latest versions yet. @jbants has developed it. Any news, James? I think for now I'd go with a normal JSON Schema Validator that can pull in the external references.

charlesbluca commented 4 years ago

Added some basic CI using jsonschema instead! I'll leave this open in case we can figure something out with stac_validator.

m-mohr commented 4 years ago

Things got on speed today... I started working on a STAC validator, for node though. Other people are working on refreshing the python implementations.

rabernat commented 4 years ago

Based on the discussion in https://github.com/radiantearth/stac-spec/issues/781#issuecomment-686480936, it sounds like the python stac validator may be working now. Should we give it a try again?

https://github.com/m-mohr/stac-node-validator/blob/master/COMPARISON.md

m-mohr commented 4 years ago

One caveat: You are using an external JSON Schema for validating your extension, which is currently only supported by the Node Validator. But for general validation against the STAC Core and other extensions, the Python validator works just fine. It's the "Validates External / Custom Extensions" entry in the table...

Edit: Although I now see there's the --custom flag, which might work...

rabernat commented 4 years ago

You are using an external JSON Schema for validating your extension

Can you help me understand this? What is the external JSON schema you are referring to?

m-mohr commented 4 years ago

@rabernat See my comment here, which should explain it based on an example: https://github.com/NCAR/esm-collection-spec/pull/23/files#r482980123

rabernat commented 4 years ago

Thanks for the feedback. Again, I think there is some confusion around esm-collection-spec. The catalog in this repo does not yet attempt to use esm-collection-spec. For now, we are simply trying to catalog indivudal zarr stores in a standard STAC catalog hierarchy. So there is no external schema.

m-mohr commented 4 years ago

Okay, yeah, I'm indeed a bit confused.

rabernat commented 4 years ago

There are basically two scenarios: