rpm-software-management / dnf5

Next-generation RPM package management system
Other
250 stars 86 forks source link

Document deprecation for API functions #865

Open inknos opened 1 year ago

inknos commented 1 year ago

Currently, DNF5 does not have a clear policy on how to deprecate public API functions. We should document the process and be clear on how to intervene in such instances. Take this commit, which generated the discussion, as an example.

jan-kolarik commented 6 months ago

The current approach to handling deprecated methods has been reported as insufficient by our API clients. Before implementing any changes, we should review existing standards to increase the likelihood of detecting issues using the existing CI checkers deployed by our dependents.

jan-kolarik commented 1 day ago

I think it’s time to decide on an approach here. Following @inknos’s proposal, here are my suggestions:

:clock10: Deprecation timeline documentation

Align with Fedora release cycles: mark objects or methods as deprecated at the start of a release and remove them in the subsequent release. Document this approach in our documentation.

:loudspeaker: Deprecation signaling implementation

Documentation visibility

Mark deprecated elements in docstrings with @deprecated and apply a custom style to make this tag more visible in upstream docs.

Optionally, create a dedicated deprecation list section.

Build-time warnings for C++ users

Use [[deprecated]], which has been standard since C++14.

Runtime user notifications

Define e.g. a LIBDNF_DEPRECATED macro wrapper to log a warning to stderr whenever a deprecated method is called. Question: Should this also apply to C++ API users, even though they already receive a build-time warning?