From 8ed1de022684e9255cceb9a6fee9958d36261d98 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 23 Dec 2023 18:09:46 +0000 Subject: [PATCH 1/4] Update doc version switcher --- doc/_static/switcher.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/_static/switcher.json b/doc/_static/switcher.json index 2a696355bb..b4f923ec52 100644 --- a/doc/_static/switcher.json +++ b/doc/_static/switcher.json @@ -1,13 +1,17 @@ [ { - "name": "v2.0 (dev)", + "name": "dev", "version": "2.0", "url": "https://hyperspy.org/hyperspy-doc/dev/" }, { - "version": "1.7", + "version": "2.0", "url": "https://hyperspy.org/hyperspy-doc/current/" }, + { + "version": "1.7", + "url": "https://hyperspy.org/hyperspy-doc/v1.7/" + }, { "version": "1.6", "url": "https://hyperspy.org/hyperspy-doc/v1.6/" From 4a91b44dda3f06ea4c6fba88f9dbe1765e77f1e0 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 23 Dec 2023 18:45:05 +0000 Subject: [PATCH 2/4] Fix `version_match` in doc version switcher --- doc/_static/switcher.json | 2 +- doc/conf.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/_static/switcher.json b/doc/_static/switcher.json index b4f923ec52..26da48c9cb 100644 --- a/doc/_static/switcher.json +++ b/doc/_static/switcher.json @@ -1,7 +1,7 @@ [ { "name": "dev", - "version": "2.0", + "version": "dev", "url": "https://hyperspy.org/hyperspy-doc/dev/" }, { diff --git a/doc/conf.py b/doc/conf.py index 4958880d2c..865fbffd70 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -161,6 +161,15 @@ favicons = ["hyperspy.ico", ] +# For version switcher: +# For development, we match to the dev version in `switcher.json` +# for release version, we match to the minor increment +import hyperspy +_version = hyperspy.__version__ +version_match = "dev" if "dev" in _version else ".".join(_version.split(".")[:2]) + +print("version_match:", version_match) + html_theme_options = { "show_toc_level": 2, "github_url": "https://github.com/hyperspy/hyperspy", @@ -190,7 +199,7 @@ "switcher": { # Update when merged and released "json_url": "https://hyperspy.org/hyperspy-doc/dev/_static/switcher.json", - "version_match": version, + "version_match": version_match, }, "navbar_start": ["navbar-logo", "version-switcher"], "announcement": "HyperSpy API is changing in version 2.0, see the release notes!", From 2bac1b3852389715f616af3535e93d51944c3956 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 23 Dec 2023 18:16:23 +0000 Subject: [PATCH 3/4] Fix link changelog development version --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0909d4f2e3..c5f3bef7db 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Changelog ********* Changelog entries for the development version are available at -https://hyperspy.readthedocs.io/en/latest/user_guide/changes.html +https://hyperspy.readthedocs.io/en/latest/changes.html .. towncrier-draft-entries:: |release| [UNRELEASED] From 1812dd71c1c2b7bf686987c505fd8745ecae2dbb Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 23 Dec 2023 19:08:37 +0000 Subject: [PATCH 4/4] Add changelog entry --- upcoming_changes/3291.maintenance.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 upcoming_changes/3291.maintenance.rst diff --git a/upcoming_changes/3291.maintenance.rst b/upcoming_changes/3291.maintenance.rst new file mode 100644 index 0000000000..a278dd8831 --- /dev/null +++ b/upcoming_changes/3291.maintenance.rst @@ -0,0 +1 @@ +Update version switcher. \ No newline at end of file