While working on
DM-20154, I wanted to mark a Config field as deprecated, but we have no system for doing that (other than just adding a docstring). Kian-Tat Lim suggested an approach on slack, which I have implemented in DM-20378. An update to the developer guide is in progress.
This design adds a deprecated attribute to pex.config.Field, which defaults to None. If it is not None, it is appended to the docstring of the Field, which lets it be preserved when the Config is saved. For example, if we have Field(doc="Some Text", deprecated="to remove in v1234"), the docstring for field would be "Some Text. Deprecated: to remove in v1234".
The Field will also emit a FutureWarning if a value is assigned to it, to inform users about the deprecation.