Skip to content

Use mike to versionise the website. - #538

Merged
gouttegd merged 3 commits into
masterfrom
versionise-entire-website
Apr 24, 2026
Merged

Use mike to versionise the website.#538
gouttegd merged 3 commits into
masterfrom
versionise-entire-website

Conversation

@gouttegd

@gouttegd gouttegd commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Resolves [#530]

  • docs/ have been added/updated if necessary
  • make test has been run locally
  • tests have been added/updated (if applicable)
  • CHANGELOG.md has been updated.

This PR configures MkDocs to use mike in order to create a fully versionised website.

Edit: Forget what’s below, unless you want for some reason to test the entire procedure for yourself. Go directly to that comment if you just want to see what the result would look like.

Full procedure for generating the versionised website for testing:

To test the result:

  1. Make sure you have the gh-pages branch locally tracked in your local repo. If not:
$ git branch -t gh-pages origin/gh-pages
  1. Create a tag on the gh-pages branch (so that you can easily revert all the changes you’ll have to do on that branch in order to test the versionised website):
$ git tag savepoint gh-pages
  1. Checkout the branch corresponding to this PR:
$ git branch -t versionise-entire-website origin/versionise-entire-website
$ git checkout versionise-entire-website
  1. Wipe out the current content of the gh-pages branch
$ uv run mike delete --all
  1. Build the dev version of the documentation:
$ make gendoc
  1. Deploy the dev version of the documentation and set it as the default version:
$ uv run mike deploy dev
$ uv run mike set-default dev

Now you need to build the website for version 1.0:

  1. Checkout the tag corresponding to the 1.0 version:
$ git checkout v1.0.0
  1. Amend pyproject.toml to add mike to the docs dependency group and amend mkdocs.yml to add the mike configuration (as is done on this PR, but now you need to back port that to your local checkout of the v1.0.0 tag).

  2. Build the documentation for version 1.0. Remember that we were not using uv yet back in 1.0, so you must make sure you still have Poetry around:

$ make gendoc
  1. Deploy the 1.0 documentation:
$ poetry run mike deploy 1.0
  1. Switch back to the versionise-entire-website branch (strictly speaking not necessary, but this allows to be able to use uv back and avoid having to use Poetry more than strictly necessary):
$ git checkout versionise-entire-website
  1. Launch a local web server to serve the entire website:
$ uv run mike serve

You can now browse the versionised website on https://localhost:8000/.

Once you are done with your tests, restore the original gh-pages:

$ git checkout gh-pages
$ git reset --hard savepoint
$ git checkout master

Add `mike` as a documentation dependency and configure mkdocs to use it.
This allows to versionise the entire website.
@gouttegd
gouttegd force-pushed the versionise-entire-website branch from 6721cbd to 6d8cd01 Compare April 22, 2026 17:58
@gouttegd gouttegd self-assigned this Apr 22, 2026
@gouttegd
gouttegd requested a review from matentzn April 22, 2026 17:59
@gouttegd

gouttegd commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

Alternatively, if you don’t want to have to bother with saving the state of the gh-pages branch, pass a -b <TEMPORARY_BRANCH_NAME> option to all calls to mike, as in:

$ uv run mike deploy -b test-mike dev
$ uv run mike set-default -b test-mike dev
... 
$ poetry run mike deploy -b test-mike 1.0
...
$ uv run mike serve -b test-mike

And then delete the test-mike branch when you’re done testing.

@gouttegd

Copy link
Copy Markdown
Contributor Author

Alternatively, if you don’t want to have to bother with saving the state of the gh-pages branch, pass a -b <TEMPORARY_BRANCH_NAME> option to all calls to mike, as in:

[…]

I created and pushed a test-mike branch where all of that has already been done, so if you want an easy way to see the result:

  1. Check-out the versionise-entire-website branch:
$ git branch -t versionise-entire-website origin/versionise-entire-website
$ git checkout versionise-entire-website
  1. Have a local test-mike branch tracking the remote test-mike branch (no need to check it out).
$ git branch -t test-mike origin/test-mike
  1. Run mike serve:
$ uv run mike serve -b test-mike

And browse the versionised website on http://localhost:8000/.

matentzn
matentzn previously approved these changes Apr 23, 2026

@matentzn matentzn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is fantastic. I tested it locally and it works great! Minor hypothetical comment,

Comment thread Makefile
@gouttegd

Copy link
Copy Markdown
Contributor Author

Of note, before that PR is merged, we should merge the test-mike branch into gh-pages. This way, when we merge here and the deploy-documentation workflow is triggered, the gh-pages will be ready.

Before actually trying to deploy the documentation, make sure to
configure a Git username and Git email. This was previously taken care
of automatically by `mkdocs gh-deploy`, but `mike` apparently does not
do that.
@matentzn
matentzn enabled auto-merge (squash) April 24, 2026 12:25
@matentzn
matentzn requested a review from cthoyt April 24, 2026 12:26
@matentzn
matentzn disabled auto-merge April 24, 2026 12:30

@cthoyt cthoyt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't look into this carefully, but it's Friday so it's the perfect time to :shipit:

@gouttegd
gouttegd merged commit 6732c71 into master Apr 24, 2026
3 checks passed
@gouttegd
gouttegd deleted the versionise-entire-website branch April 24, 2026 13:27
@cthoyt

cthoyt commented Apr 29, 2026

Copy link
Copy Markdown
Member

cthoyt added a commit that referenced this pull request May 26, 2026
Following #538, this PR rebuilds all artifacts with `make gen-project`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants