canonical / craft-cli

https://canonical-craft-cli.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
9 stars 15 forks source link

fix(dispatcher): revert a change in return type annotation #177

Closed tigarmo closed 11 months ago

tigarmo commented 11 months ago

Commit b0698f9 changed the type annotation for the return value of BaseCommand.run() from Optional[int] to the semantically-equivalent preferred notation int | None.

However, this is a breaking change in the case of subclasses that override this method, return only None and use the override decorator from non-latest versions of the override package, as those versions do not realize that None is a valid subset of int | None.

Although the fix in client code is simple, the original commit was not meant to break client code at all. Therefore, revert this specific change until we are ready to release a new major version.

codecov[bot] commented 11 months ago

Codecov Report

Merging #177 (bcbcda8) into main (41246d1) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #177   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files           7        7           
  Lines        1042     1042           
  Branches      190      190           
=======================================
  Hits          986      986           
  Misses         53       53           
  Partials        3        3           
Files Changed Coverage Δ
craft_cli/dispatcher.py 99.13% <100.00%> (ø)