gwosc-tutorial / gwosc-catalog

Scripts and modules to be used in community catalog uploads to GWOSC website
0 stars 0 forks source link

schema version #22

Closed martinberoiz closed 3 months ago

martinberoiz commented 3 months ago

Adds a schema version to the schema + linting.

jroulet commented 3 months ago

This looks good so far! But it's not implemented in the code. I wonder if it would be better to implement it before merging? E.g. make version an attribute of the Catalog class, whose value is somehow set automatically to match the current version of the package?

martinberoiz commented 3 months ago

ooh, I see what you mean... I didn't think about that, but I think your solution makes sense. Let me try adding it like you suggested.

martinberoiz commented 3 months ago

I don't have much experience with dataclasses and typing in python, does this change make sense to you?

from . import __version__

...

@dataclasses.dataclass
class Catalog:
    """Contains events detected/analyzed by a pipeline.

    Fields
    ------
    version: str
        The schema version.

    catalog_name: str
   ...
    """
    version: str = ".".join(__version__.split(".")[:2])

I thought maybe we don't include the patch part of the version ("1.0" instead of "1.0.0")

martinberoiz commented 3 months ago

@jroulet How about now?

martinberoiz commented 3 months ago

Looks good. Is it good to merge now?

jroulet commented 3 months ago

Yes, go ahead