Remove @property
implementations for field access
#262
Labels
Milestone
@property
implementations for field access
#262
Note: this change requires updating the cookbook documentation. issue forthcoming...
The initial intention of using the
@property
annotation for field access was to provide compatibility between Connect versions without having to modify code using posit-sdk. Since then, I've yet to encounter a field whose name has changed between Connect versions. Therefore implementing property methods has introduced a lot of cruft in the codebase. Additionally, we often have to mark getters with# type: ignore
to ensure compatibility, which is counterintuitive.An alternative solution to compatibility between Connect versions is to override the getitem and setitem methods as shown below. This is a simple approach and much more concise than our current implementation.
Since this is breaking change, I propose a two-phased approach..
Phase 1 (next minor release e.g., v.0.5.0)
Remove all property methods for field access and implement getattr and setattr on
Resource
as follows. This implementation should also include a deprecation warning.Phase 2 (next major release e.g., v1.0.0)
Remove the getattr and setattr implementations defined above.
The text was updated successfully, but these errors were encountered: