graph_weather icon indicating copy to clipboard operation
graph_weather copied to clipboard

Update configuration to use dacite/pyserde

Open jacobbieker opened this issue 1 year ago • 5 comments

Update the configuration system to use type checking and something like dacite or pyserde

Context

Easier configuration, and included type checking to help catch bugs/issues

Possible Implementation

Dactie or pyserde are both nice options.

jacobbieker avatar Oct 21 '24 23:10 jacobbieker

@jacobbieker could i work on this?

FilippoContessa avatar Jan 03 '25 22:01 FilippoContessa

Yeah! I'd recommend starting with just one of the issues you've commented on, and can go from there as you finish them?

jacobbieker avatar Jan 04 '25 00:01 jacobbieker

@jacobbieker can I take this up? also I had a quick look, is the following close to what you are looking for?

replace ->

# Some configs from graphcast: 
_spatial_features_kwargs = dict(
    add_node_positions=False,
    add_node_latitude=True,
    add_node_longitude=True,
    add_relative_positions=True,
    relative_longitude_local_coordinates=True,
    relative_latitude_local_coordinates=True,
)

with ->

from dataclasses import dataclass
from dacite import from_dict

@dataclass
class SpatialFeaturesConfig:
    add_node_positions: bool = False
    add_node_latitude: bool = True
    add_node_longitude: bool = True
    add_relative_positions: bool = True
    relative_longitude_local_coordinates: bool = True
    relative_latitude_local_coordinates: bool = True

config_dict = {
    "add_node_positions": False,
    "add_node_latitude": True,
    "add_node_longitude": True,
    "add_relative_positions": True,
    "relative_longitude_local_coordinates": True,
    "relative_latitude_local_coordinates": True,
}

_spatial_features_kwargs = from_dict(data_class=SpatialFeaturesConfig, data=config_dict)

ACSE-vg822 avatar Jan 24 '25 17:01 ACSE-vg822

Hey, yes! That's pretty much exactly what I was thinking. We just want to get all the configuration to be like that.

jacobbieker avatar Jan 24 '25 23:01 jacobbieker

I need help with the failing pipeline. ruff is failing for files that I didn't touch or commit :(

ACSE-vg822 avatar Jan 25 '25 18:01 ACSE-vg822

@ACSE-vg822 are you still working on this

lambaaryan011 avatar Feb 27 '25 06:02 lambaaryan011

@lambaaryan011 Hey! I was planning to finish it by this weekend. But I'd really appreciate if you can do it because I am totally occupied otherwise :(

ACSE-vg822 avatar Feb 27 '25 06:02 ACSE-vg822

@ACSE-vg822 OK let me see. The issue

lambaaryan011 avatar Feb 27 '25 07:02 lambaaryan011

@ACSE-vg822 i try this issue but there i something that i not under my shade so can you tell other to do .

lambaaryan011 avatar Mar 03 '25 12:03 lambaaryan011

Hi @jacobbieker Could you please assign this issue. to me.? Happy to contribute. Thank you!

ram-from-tvl avatar Aug 22 '25 06:08 ram-from-tvl

Sure!

jacobbieker avatar Sep 12 '25 22:09 jacobbieker