A place to cache linked articles (think custom and personal wayback machine)
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

10 个月前
10 个月前
9 个月前
10 个月前
10 个月前
9 个月前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. title: EffVer: Version your code by the effort required to upgrade
  2. url: https://jacobtomlinson.dev/effver/
  3. hash_url: fd6eda56671045e0c1e2d215e07f1a6f
  4. archive_date: 2024-01-18
  5. og_image: https://jacobtomlinson.dev/f5AJKsQ_5492213727072396532_huc4b23cc59301979e6c26bd5595602176_0_babdb9b3327c14bb629a3288d379177b.png
  6. description: Version numbers are hard to get right. Semantic Versioning (SemVer) communicates backward compatibility via version numbers which often lead to a false sense of security and broken promises.
  7. favicon:
  8. language: en_US
  9. <p>Version numbers are hard to get right. Semantic Versioning <a href="https://semver.org/">(SemVer)</a> communicates backward compatibility via version numbers which often lead to a <a href="https://hynek.me/articles/semver-will-not-save-you/">false sense of security and broken promises</a>. Calendar Versioning <a href="https://calver.org/">(CalVer)</a> sits at the other extreme of communicating almost <a href="https://jacobtomlinson.dev/posts/2023/sometimes-i-regret-using-calver/">no useful information at all</a>.</p>
  10. <p>Going forward I plan to version the projects I work on in a way that communicates <em>how much effort I expect a user will need to spend to adopt the new version</em>. I’m going to refer to that scheme as <strong>Intended Effort Versioning (<span>EffVer</span> for short)</strong>.</p>
  11. <p>
  12. <figure>
  13. <img src="https://jacobtomlinson.dev/effver/effver.png" alt="In EffVer you use a three number version separated by dots, referred to as Macro, Meso and Micro. You incremenet macro when adoption requires a large effort, meso when it requires some effort and micro when hopefully it requires little to no effort.">
  14. <figcaption>Overview of EffVer</figcaption>
  15. </figure>
  16. </p>
  17. <p><span>EffVer</span> follows the same pattern of incrementing numbers to communicate with users that SemVer does, and is forward and backward compatible with SemVer (you don’t need to use something like a <a href="https://packaging.python.org/en/latest/specifications/version-specifiers/#version-epochs">Python version epoch</a> to switch between the two schemes). The difference is that instead of quantifying the orthogonality of a change EffVer tries to quantify the intended work required to adopt the change.</p>
  18. <p>If a change fixes a small bug, adds a new feature that is orthogonal with existing features or is generally a noop for existing users then you should bump the <strong>Micro</strong> version. This signals to users that <strong>“this change doesn’t intend for you to need to do anything”</strong>.</p>
  19. <p>If a change fixes a larger bug that some users may have grown accustom to or put workarounds in place for, or makes small breaking changes to features in a way that may require some adoption then you should bump the <strong>Meso</strong> version. This signals to users that <strong>“some small effort may be required to make sure this version works for you”</strong>.</p>
  20. <p>If you make a huge breaking change or overhaul some large aspect of your project you should bump the <strong>Macro</strong> version. This signals to users that <strong>“you will need to dedicate some significant time to upgrading to this version”</strong>.</p>
  21. <h2 id="why-use-span-stylecolor-0097a7effverspan">Why use <span>EffVer</span>?</h2>
  22. <p><span>EffVer</span> may sound like “SemVer-lite” or just “SemVer done a certain way” but there are a few key things that makes <span>EffVer</span> different and worth considering.</p>
  23. <ol>
  24. <li><span>EffVer</span> communicates intentions. Software is created by humans (for now) and that while humans have the best of intentions around the impacts that new versions have, sometimes things are more impactful than expected. Instead of trying to quantify the techinical scope of a change <span>EffVer</span> tries to communicate the expected downstream impact.</li>
  25. <li><span>EffVer</span> respects that all releases impact users and will require effort to adopt them, even if that’s some simple testing or updating a lock file. By trying to quantify and communicate the effort required to adopt a release developers demonstrate respect for their user’s time.</li>
  26. <li><span>EffVer</span> doesn’t make a distinction between bugs fixes, enhancements and features (because developers struggle to make that distinction too). Instead we focus only on the effort required for existing users to adopt new versions.</li>
  27. <li><span>EffVer</span> users can more clearly reason that <em>any</em> change can result in them needing to do some work, but that the developer using <span>EffVer</span> is trying to give them information to help them quantify and plan this work.</li>
  28. </ol>
  29. <h2 id="fixing-mistakes">Fixing mistakes</h2>
  30. <p>Another core principle of <span>EffVer</span> is to acknowledge that sometimes code gets released with the wrong version number, and responsible developers should reactively fix that.</p>
  31. <p>Imagine 1% of my users are experiencing a bug, so I make a bug fix release where I intend for only those users notice that positive change. So I increment the <em>micro</em> version number and cut a release.</p>
  32. <p>However I was wrong, other users are negatively impacted by the change and have to make a small adjustment to their workflow to work around it. On reflection I am still happy with the change and don’t intend to revert it, but I should’ve incremented the <em>meso</em> version number instead to signal a larger impact. I made the change that I wanted to make, but I have accidentally generated work for others and I should respectfully communicate that to them.</p>
  33. <p>With <span>EffVer</span> we encourage developers to take some steps to update the communicated impact by cutting a few more releases.</p>
  34. <ul>
  35. <li>Imagine my starting point was version <code>2.3.4</code>.</li>
  36. <li>My bug fix was then released as <code>2.3.5</code>.</li>
  37. <li>The unhappy users open issues on GitHub and I want to change the version number to communicate the impact better.</li>
  38. <li>I check out the original <code>2.3.4</code> tag and create another new tag for this commit called <code>2.3.6</code>, this effectively reverts the impactful release so that no more users pick up the change.</li>
  39. <li>Then I check out <code>2.3.5</code>, the impactful change, and create a new tag called <code>2.4.0</code>.</li>
  40. </ul>
  41. <p>Now users who have pinned to <code>~2.3.4</code> will be upgraded to <code>2.3.6</code> which is exactly the same commit and therefore doesn’t cause them any impact. And users who have pinned to <code>^2.3.4</code> will be upgraded to <code>2.4.0</code> which correctly communicates that there may be some small intentional impact.</p>
  42. <p>I haven’t needed to change my code or make any new commits, I just add more tags to fix my communication.</p>
  43. <h2 id="zero-version">Zero version</h2>
  44. <p>In SemVer the <code>0.x.x</code> version has become known as the YOLO version because anything goes. Any change can be breaking and so the semantics around backward compatibility become meaningless.</p>
  45. <p>In <span>EffVer</span> the meaning of the zero version still denotes a codebase under development but should be treated as <code>0.Macro.Micro</code>. In a development project it is more likely that changes will have a large impact, that’s just in their nature, but it’s still useful to be able to quantify the impact between each release.</p>
  46. <p>You could also use a four segment version number with <code>0.Macro.Meso.Micro</code> if you would prefer to have the full fidelity of <span>EffVer</span> communication during development.</p>
  47. <p>As your project matures you will likely find yourself incrementing the <em>Macro</em> version less and the <em>Micro</em> version more which is a good signal for developers that it’s time to switch to a <code>1.0.0</code> release.</p>
  48. <h2 id="projects-using-span-stylecolor-0097a7effverspan">Projects using <span>EffVer</span></h2>
  49. <p>Here are some notable projects that use EffVer:</p>
  50. <p><em>Want to add your project to this list, <a href="https://github.com/jacobtomlinson/website/blob/master/content/posts/2024/2024-01-15-effver/index.md">make a PR here</a>.</em></p>
  51. <h2 id="supporting-span-stylecolor-0097a7effverspan">Supporting <span>EffVer</span></h2>
  52. <p>Do you like the sound of <span>EffVer</span>? If so that’s great! You can support the movement by sharing this post with people and by adding the <a href="https://jacobtomlinson.dev/effver">
  53. <img src="https://img.shields.io/badge/version_scheme-EffVer-0097a7" alt="Static Badge">
  54. </a> badge to any projects that are using it.</p>
  55. <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl"><span class="gh"># Badge URL
  56. </span></span></span><span class="line"><span class="cl"><span class="gh"></span>https://img.shields.io/badge/version_scheme-EffVer-0097a7
  57. </span></span><span class="line"><span class="cl">
  58. </span></span><span class="line"><span class="cl"><span class="gh"># Markdown
  59. </span></span></span><span class="line"><span class="cl"><span class="gh"></span>[<span class="nt">![EffVer Versioning</span>](<span class="na">https://img.shields.io/badge/version_scheme-EffVer-0097a7</span>)](https://jacobtomlinson.dev/effver)
  60. </span></span></code></pre></div>
  61. <h2 id="background-and-history">Background and history</h2>
  62. <p>At PyCon UK in 2023 I gave a lightning talk based on my blog post <a href="https://jacobtomlinson.dev/posts/2023/sometimes-i-regret-using-calver/">“Sometimes I regret using CalVer”</a>. My talk was immediately followed by <a href="https://hynek.me/about/">Hynek Schlawack</a> who aside from creating great Python libraries like <a href="https://github.com/python-attrs/attrs"><code>attrs</code></a> and <a href="https://github.com/hynek/structlog"><code>structlog</code></a> is known for his blog post <a href="https://hynek.me/articles/semver-will-not-save-you/">“Semantic Versioning Will Not Save You”</a>.</p>
  63. <p>Interestingly many folks assumed that our dislike of different version schemes meant we vehemently disagreed with each other, but far from it. We totally agreed that the two most popular versioning schemes were imperfect and this resulted in some excellent post-conference pub discussion.</p>
  64. <p>Ever since then I’ve not been able to stop thinking “there has to be another option”.</p>
  65. <h3 id="the-challenges-of-existing-schemes">The challenges of existing schemes</h3>
  66. <p>Both my and Hynek’s blog posts go into detail about the failings of existing schemes, but I want to focus on the attributes that translate to work required by downstream users.</p>
  67. <h4 id="semver">SemVer</h4>
  68. <p>SemVer attempts to communicate if an upgrade is safe or not, but can easily get this wrong.</p>
  69. <p>When you fix a bug in your code you can argue that the code is now “more correct”. SemVer assumes it is safe for <em>everyone</em> to adopt this new code immediately because of this increased “correctness”, but the trap that SemVer falls into is the fact that every bug has users.</p>
  70. <p>
  71. <figure>
  72. <img src="https://jacobtomlinson.dev/effver/xkcd-1172-workflow.png" alt="xkcd 1172: workflow. A comic strip showing a user who is upset that holding the space bar no longer makes their computer overheat because they relied on that behaviour">
  73. <figcaption><a href="https://xkcd.com/1172">xkcd #1172: Workflow</a></figcaption>
  74. </figure>
  75. </p>
  76. <p>People trust SemVer to not break their code and then feel angry when things go wrong because when SemVer fails users have to react and often have urgent work to do.</p>
  77. <h4 id="calver">CalVer</h4>
  78. <p>CalVer attempts to communicate that no upgrade is safe, but in doing so strips all useful information from the version number.</p>
  79. <p>For example if you fix a small bug in your code and make a release, then the next day you delete half the API and make another release, nobody can tell the difference between the two versions.</p>
  80. <p>
  81. <figure>
  82. <img src="https://jacobtomlinson.dev/effver/happy-new-year.png" alt="A meme showing two scary dragons and a derpy one to describe major version releases. The first is ChangeVer and says there are major new and exciting things, the second is SemVer and says we broke something and the third is CalVer which says happy new year.">
  83. <figcaption>If you're wondering what ChangeVer is, it's what I call the 90s boxed software version scheme where you were obliged to make visible changes to your prouct and increment the major version in order to get people to upgrade from the old version. Change for the sake of change.</figcaption>
  84. </figure>
  85. </p>
  86. <p>People feel anxious about upgrading CalVer projects because they don’t know if the change will be small or huge. As a result they are more likely to pin their dependencies and upgrade in a more proactive and managed way, which is good, but the lack of information makes upgrading hard to schedule and so it often gets put off.</p>
  87. <p>If you read the CalVer website they <a href="https://calver.org/#ubuntu">highlight Ubuntu</a> as a high-profile user of CalVer. However, Ubuntu has shoehorned in a bunch of semantics to their versioning scheme by only creating April and October releases to make it clearer to users which versions are <em>major</em> versions. They wanted to communicate which versions take more effort to migrate between because communicating user impact is important.</p>
  88. <h3 id="momentum">Momentum</h3>
  89. <p>The biggest challenge for switching version scheme is the momentum of other schemes in the ecosystem. SemVer is well established, and CalVer is also very common. Because of that <span>EffVer</span> is intentionally identical in structure to SemVer. This means that any tooling or process assumptions built around SemVer will work for <span>EffVer</span>.</p>
  90. <p>Any SemVer project can switch to <span>EffVer</span> by just changing how they decide the version number of the next release. If you try <span>EffVer</span> out and would prefer to go back to traditional semantics then switching back is also just the same process change.</p>
  91. <p>Switching to CalVer is more of a one way street, and although some languages have a <a href="https://packaging.python.org/en/latest/specifications/version-specifiers/#version-epochs">process for switching back</a> it’s not guaranteed to be a smooth ride. So if you ever do switch to CalVer can I suggest you use <code>YY.MM.DD</code> instead of <code>YYYY.MM.DD</code>, that way you could switch back to <span>EffVer</span>/SemVer and keep your <em>major</em> version number below 100.</p>