stravalib icon indicating copy to clipboard operation
stravalib copied to clipboard

Deprecate of Activity.TYPES attr in model.py (when we fully deprecate types in favor of sport_types)

Open lwasser opened this issue 1 year ago • 4 comments

In the model.py module there is a attr that was added for backward compatibility

    # Added for backward compatibility
    # TODO maybe deprecate?
    TYPES: ClassVar[Tuple[Any, ...]] = get_args(
        ActivityType.__fields__["__root__"].type_
    )

It might be best to deprecate this as discussed here in the review of #387

lwasser avatar Aug 11 '23 00:08 lwasser

this seems like a small issue that one of us would be able to knock out easily! @enadeau you and i had discussed this back in august. Should we remove the types attr in model.py? Strava now favors sport_type over type. But i'm not sure if this will break things or not for some users?

lwasser avatar Apr 18 '24 01:04 lwasser

@jsamoocha there is a note in this section of the code to deprecate this element. It returns the (deprecated?) type list of accepted values. should i submit a quick PR to remove it in our 2.0 work and add this to our 2.0 milestone?

i'm just trying to see where we can knock out issues that have been opened for a while as we go.

lwasser avatar Jun 16 '24 01:06 lwasser

I actually looked into this more. I think we should KEEP the TYPES attr until we fully remove the deprecated types (in favor of sport_types) attribute. we use .TYPES throughout to check if someone using the deprecated types list of valid types is in deed referencing a valid TYPE. When we remove it altogether in favor or sport_type let's remove. i'm doing to pull this off of the stravalib 2.0 milestone list UNLESS we decide to fully deprecate types.

lwasser avatar Jun 16 '24 17:06 lwasser

Yes, we can always deprecate this later. The TYPES attribute is unrelated to the pydantic v2 migration.

jsamoocha avatar Jun 16 '24 17:06 jsamoocha

ok - i think i will close this issue given there is no timeline on when we wish to deprecate but we might want to do so when strava fully removes it. We can always reopen. i'm trying to clean up issues!

lwasser avatar Jul 19 '24 22:07 lwasser