-
Notifications
You must be signed in to change notification settings - Fork 47
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
New blog post: Documentation Versioning #74
Changes from all commits
79a89c1
15d4a0b
1bc0a8e
ed9e84c
82bca4b
970f473
052a75e
e9b2180
a1edf2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.. post:: July 23, 2019 | ||
:tags: versioncontrol, documentation | ||
:author: Manuel | ||
:location: BCN | ||
|
||
.. meta:: | ||
:description lang=en: | ||
|
||
Recommendations about how to do documentation versioning. | ||
|
||
Documentation Versioning: Best Practices | ||
======================================== | ||
|
||
Project releases and documentation versions are strongly related each other. | ||
You usually want to have a release ``1.0.3`` with it's own documentation version ``1.0.3`` for that specific release. | ||
|
||
When you make a new release of your software, | ||
you create a new tag in your :abbr:`VCS (Version Control System)` for this release and activate this new version on Read the Docs. | ||
At this point, Read the Docs will build and publish the new documentation version ``1.0.3`` for you. | ||
|
||
This approach of "VCS tag mapped to a Read the Docs version" works in most cases. | ||
There are sometimes problems with this approach that we can prevent using a different strategy. | ||
|
||
|
||
Problems of using tags for documentation versions | ||
------------------------------------------------- | ||
|
||
The main problem of using VCS tags to build documentation versions is that they are *static*. | ||
Once a tag is created it can never be modified. [#]_ | ||
|
||
This may not seem like a problem at first, since that's the main concept of VCS tags. | ||
When talking about documentation versions, | ||
sometimes after making a release there is a typo in the docs, or a small code example that doesn't work, | ||
and you want to fix it. | ||
|
||
Making a new tag just for these small changes isn't worth the effort, and also it can confuse users. | ||
|
||
Another problem that we have found with this approach is when new features are released on Read the Docs. | ||
Adding this new feature to all of your documentation versions is impossible. | ||
Similarly, if you want to install a new Sphinx extension in all your versions, | ||
update one of its settings, change the theme, | ||
or even change a build config in the `.readthedocs.yml`_, | ||
you will be "blocked" by the tags being static. | ||
|
||
|
||
Recommended versioning strategy | ||
------------------------------- | ||
|
||
**The workflow we recommend for versioning your documentation is having release branches.** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get that this idea effectively encourages projects to follow Trunk Based Development https://trunkbaseddevelopment.com/ but there are other schemes https://www.toptal.com/software/trunk-based-development-git-flow I wonder how applicable this is for projects not following Trunk Based Development |
||
With this approach, if a reader detects a typo in the documentation, | ||
you can just fix the typo and commit and push to this ``1.0.x`` release branch. | ||
By doing this, the documentation will be automatically updated and published on Read the Docs. | ||
|
||
Following our example, this strategy would be: | ||
|
||
* ``1.0.x`` is a release branch for the ``1.0`` version | ||
* ``1.0.3`` is a similar tag for your ``1.0.x`` branch, with the latest release | ||
* ``1.0.0`` is the first tag for your ``1.0.x`` branch. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we need to expand more on this. This mostly matches what I had here: https://www.ericholscher.com/blog/2016/jul/1/sphinx-and-rtd-for-writers/#recommended-versioning-system -- but what do we do with the tags and old links to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I took the inspiration from there and my goal was to expand it and make it better. I failed 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the key is that if there will be more 1.0.x releases, there should be a release branch and documentation builds off that branch. If you have a typo in the docs or an example in the docs that doesn't work, you just make a new version and the It also depends on whether there will be multiple concurrent versions. For example, Django is currently supporting 1.11.x, 2.1.x and 2.2.x and there are large differences between these. Users definitely should be looking at the right docs for their version. If instead, you just want to have a few old versions of the docs around for users using the old stuff then I think tags are mostly fine. However, again if you're following semver you probably don't need docs for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I mean you have the docs in VCS but you don't need published docs for both when they're basically exactly the same. |
||
|
||
In summary | ||
---------- | ||
|
||
It's a good idea to have a plan about versioning your software and documentation before going too far. | ||
Knowing the limitations on the different strategies will give you more context to make a better decision. | ||
This will avoid you headaches in the future or even re-tagging VCS tags just to fix small documentation issues. | ||
|
||
Happy versioning! | ||
|
||
.. _.readthedocs.yml: https://docs.readthedocs.io/page/config-file/v2.html | ||
.. [#] It's technically possible, but not recommended by all packaging tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django and Flask don't do this. I'd actually say if you're following semver you probably don't need to document below the minor version level (eg.
1.0.x
).