-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semantic Versioning for Annif releases beyond 1.0 #616
Comments
For ZBW the main issue in the past has been compatibility of serialized model between versions. Unfortunately this is the hardest part as this can break when dependencies are updated or for different Python versions. Therefore, also a change of the Python version in the Docker container should lead to a major version increment if the models become incompatible. The following will be my thoughts on the other areas mentioned in the issue: CLIAs the CLI is the main interface taught in the tutorial, it is probably used by most people. Changing the interface and also default values could become a problem for commands that take a long time (train/eval/index). During manual interaction, users could probably adapt but could get frustrated if a command takes a long time to finish and the output is different than expected. Rest APII concur that there is no issue in adding methods between minor versions. Web UIAlso agree that it probably could change between minor versions as user could adapt quickly Configuration FilesIf default values change you may get a completely different model, possibly breaking the predictive power of your model. VocabularyIf you have to break the compatibility you should make sure that old vocabularies can not be loaded. Python APIWe actually use Annif as Python library for parameter optimization but we are aware that this is not intended and the risk is calculated. |
Thank you for your thoughts @mo-fu ! This is very valuable and we seem to be in agreement on the big issues.
Yes, this is true and should be considered when choosing the version number for a new release.
You are of course welcome to do this, but I think whether a new version is expected to work with old model files is something that is generally known around release time and this should be (and has been - at least we've tried!) communicated in the Release Notes. It should not be up to users such as ZBW to discover that models have broken, but verifying it never hurts. |
There is also one more aspect of compatibility that I forgot above: AnalyzersAnalyzers are used to pre-process text and do things like stemming and lemmatization. But they also change over time, and a word may no longer be lemmatized the same way - see this comment for an actual example. New versions of lemmatizers like spaCy and Simplemma are released quite frequently and we probably want to keep up with them without too much delay. But there is a problem with old models trained using the old analyzers - they assume certain words are lemmatized in one way, and when that assumption breaks, the model may perform worse than it did before. This could be a particularly big issue for the MLLM lexical model, which relies a lot on words being lemmatized in a consistent way. |
General CLI commands REST API WEB UI Configuration files Vocabulary data Project/model data Python API Python environment Analyzers Additional: Annif container images Greetings, Christoph & Sandro for the DNB Team |
Thank you all for your input so far. As a first step towards improving awareness of backward compatibility issues between Annif versions, we have included a new section "Backward compatibility" in the release notes of Annif 0.59 and intend to keep this section in future release notes as well. |
I created a page in Wiki describing the requirements and policies for the backward compatibility of Annif public API based on the discussion in this issue. I close the issue, but it can still be commented. EDIT: I fixed the link URL since the wiki page got renamed --@osma |
Semantic Versioning is a set of good practices for version numbers that reflect the expected amount (or lack of) backward compatibility in a software release. All Annif releases so far have been in the 0.x series, where there are no strict rules and anything is allowed, which is good for initial fast development. However, Annif is nowadays used in production in at least four large institutions (NatLibFi/FintoAI, Yle, ZBW, DNB) and according to the SemVer FAQ, "If your software is being used in production, it should probably already be 1.0.0.". So we should aim at releasing version 1.0.0 somewhere in the not-so-distant future (during the year 2023). This will bring us into a new era where we have to be more careful about backwards compatibility and selecting version numbers for new releases in a way that follows the SemVer principles.
The guiding principle of semantic versioning is to document the public API of the software project and then to try to avoid introducing backwards incompatible changes to that API; if such changes must be made, this requires a new major release. This begs the question what is the public API of Annif? It isn't primarily a software library (although it could be used that way) but a tool that is commonly used via the CLI and/or the REST API, with configuration files and data stored on disk. We need to define the policy for what may and may not change, particularly for minor releases (e.g. 1.0.0 -> 1.1.0) which require the most judgement.
Here is a breakdown of the possible aspects of backwards compatibility and some suggestions for what could be the policy for what is and isn't allowed in a minor version release. Overall, I think it makes sense to consider the perspective of the Annif user (and/or the person who is managing the installation); a minor version should be a smooth upgrade that in most cases shouldn't require any changes apart from the upgrade itself (although some changes could be beneficial, for example enabling new features). There is obviously a tradeoff here: we want upgrades to be smooth, but a very strict policy on backwards compatibility makes it more likely that major versions need to be released often, which is probably not what we want.
CLI commands
Possible policies for CLI commands:
If we choose the latter (less strict) policy, it means that scripts that run Annif commands are best written so that they avoid relying on default values, so that they don't break when the defaults change.
It is also possible (and allowed) to deprecate some CLI commands in a minor release. However, removing a CLI command completely would require a major release.
The output of CLI commands may also be considered part of the API, in particular for commands like
annif eval
whose output is meant to be easily processed using tools likegrep
andsed
. I think that the sensible approach would be to state that the output of /some/ commands (includingeval
andhyperopt
) must stay the same except that it's allowed to introduce new output lines that follow the same syntax (e.g. new evaluation metrics).REST API method calls
The REST API already includes a version number prefix (currently
/v1/
) so it is expected that any backwards incompatible changes would require incrementing that version prefix. If support for the old API version is removed, this would naturally also trigger a new major release of Annif. What is considered a breaking change for the REST API is another discussion, but that is out of scope for Annif version numbers.Web UI
The Web UI relies on the REST API for all operations. I don't think it makes sense to restrict changes to the web UI, since it's not something that is normally used programmatically but by human users. So any kind of changes to the Web UI may be made in minor releases of Annif.
Configuration files
Configuration files (e.g.
projects.cfg
,projects.toml
) are managed by the user and thus it's not desirable that they need to be changed because of a minor version upgrade. Possible policies:The policy could also be different for core vs. optional backends. If for example upstream Omikuji changes its default values, would this trigger a new major release of Annif?
Vocabulary data
The vocabulary is loaded with the
annif loadvoc
command and ideally would not need to be reloaded due to a version upgrade. So the suggested policy is that for minor Annif releases, previously loaded vocabularies should keep working. If there are changes to the format on disk, there should be an easy (and if possible, automatic) migration mechanism available so that a full reload is not necessary.Project/model data
This is probably the most difficult part, since Annif relies a lot on external libraries for the backends, and some of those tend to change frequently in backwards-incompatible ways (e.g. Omikuji), or at least complain about data files saved using previous versions (e.g. scikit-learn vectorizers used by many backends). Some possible policies for minor releases:
The first two are probably too strict and would either trigger frequent major releases or hold back important upgrades of external libraries.
Python API
As said above, Annif isn't primarily a software library. Thus, any changes to the Python API (e.g. method signatures) are considered internal and are allowed in minor versions.
Python environment
Annif has tried to maintain support for three consecutive Python versions and this window is occasionally shifted forward. Nowadays new Python minor releases (e.g. 3.9, 3.10, 3.11) are made on a 12-month schedule, with the release made in October. Would dropping support for an old version of Python require a major release of Annif? Possible policies for minor releases:
The first (strictest) option would in the long term imply a new major version of Annif at least once per year, because old Python versions cannot be supported indefinitely. I think the second or third options make the most sense. The second option is possibly too conservative (e.g. support for Python 3.7 could be dropped in June 2023 and for Python 3.8 in October 2024 - but support for 3.7 was dropped in Annif 0.58 released in August 2022!), while the third option reflects the status quo.
Next steps
I invite all Annif users, particularly those involved in production installations, to comment on the above suggestions. After the discussion, we need to turn this into a specification (e.g. a wiki page) that documents the policies on how semantic versioning is applied for Annif releases beyond 1.0.0.
The text was updated successfully, but these errors were encountered: