Skip to content
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

Closed
wants to merge 9 commits into from
71 changes: 71 additions & 0 deletions documentation-versioning.rst
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.
Copy link
Contributor

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).


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.**
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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 1.0.3 when 1.0.4 is released? I think we need a bit more guidance there.

Copy link
Member Author

@humitos humitos Jul 24, 2019

Choose a reason for hiding this comment

The 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 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The 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 1.0.x docs get updated.

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 1.0.3 and 1.0.4. I think that's worth mentioning in this post!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're following semver you probably don't need docs for 1.0.3 and 1.0.4

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