BioAlignments.jl icon indicating copy to clipboard operation
BioAlignments.jl copied to clipboard

Friendly request to `@deprecate` API changes via semver

Open dehann opened this issue 1 year ago • 2 comments

Hi BioAlignments,

Just wanted to put in a friendly request for API changes to follow Julia's @deprecate pattern for API changes please, so for example in package v0.1.x:

# src/AwesomeCode.jl
oldsignature(x::Int) = # does thing

Then the API change goes into v0.2.0 along with the deprecation

# src/AwesomeCode.jl
newsignature(x::Float64) = # does similar thing

# src/Deprecated.jl
@deprecate oldsignature(x::Int) newsignature(float(x))

This will give users a chance to update their scripts with a useful auto-generated warning, which tells them how to replace old calls with new ones.

Then remove the deprecation in v0.3

# src/AwesomeCode.jl
newsignature(x::Float64) = # does similar thing

Also consider listing breaking changes in a NEWS.md. Based on a quick search it looks like the @deprecate feature is not used here much.

Thanks for the great package!

dehann avatar Aug 24 '22 02:08 dehann

Oh, there is also overwriting the Base.getproperty(obj::MyType, f::Symbol) when deprecating fields in a struct. And then inside that use Base.getfield to avoid stack overflows.

Can close this issue on comment received :-)

dehann avatar Aug 24 '22 02:08 dehann

Yeah, we definitely should do this throughout BioJulia, especially after packages have reached v1.0. Apologies for the failure to do so in the past. In principle, we could even do patch-releases on previous versions retroactively, though I'm not sure how much effort that's worth.

Unfortunately, developer time in this ecosystem is pretty limited - I suspect this is why it wasn't done in the past. As an aside, if you want to make a PR for this purpose, I think it would be very warmly received :-)

kescobo avatar Aug 25 '22 15:08 kescobo