Skip to content

Use stable version for dev docs bundle links#973

Merged
TimMonko merged 10 commits intonapari:mainfrom
TimMonko:fix/bundle-links
Apr 9, 2026
Merged

Use stable version for dev docs bundle links#973
TimMonko merged 10 commits intonapari:mainfrom
TimMonko:fix/bundle-links

Conversation

@TimMonko
Copy link
Copy Markdown
Contributor

@TimMonko TimMonko commented Mar 27, 2026

References and relevant issues

Closes #969

Description

Instead of just the raw release link, which can be broken for dev releases (i.e. 0.7.1dev#sha) this changes it so that
It will be the latest stable release.

To do this, I have it check whether the current ref is a prerelease, and if it is, then it checks version_switcher.json for the entry with "preferred" and returns it's "version". Thus both 0.7.1rc0 and 0.7.1dev+hash will point back to the preferred version (0.7.0).

Then, when a new stable release is pushed, the ref is no longer a pre-release and will instead use the version string (which I think in all cases is X.Y.Z from how I read the code) so releasing 0.7.1 should use 0.7.1 for the links, despite the version_switcher not yet being updated.

I also slightly updated the Mac buttons and install section so that it cleared up uncertainty re: the intro-workshop download

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 27, 2026

- {{ '[napari-REL-macOS-arm64.pkg](https://github.com/napari/napari/releases/download/vREL/napari-REL-macOS-arm64.pkg)'.replace('REL', release) }} — Apple Silicon (M1 and later)
- {{ '[napari-REL-macOS-x86_64.pkg](https://github.com/napari/napari/releases/download/vREL/napari-REL-macOS-x86_64.pkg)'.replace('REL', release) }} — Intel
- {{ '[napari-REL-macOS-arm64.pkg](https://github.com/napari/napari/releases/download/vREL/napari-REL-macOS-arm64.pkg)'.replace('REL', bundle_release) }} — Apple Silicon (M1 and later)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@psobolewskiPhD here also is where I mention arm64 and Apple Silicon.

I've never used mac so I genuinely don't know the correct answer here.

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.

Yeah same issue. I think linking the apple docs is probably the best, but otherwise we could try
(M- or A-series) or something like that.

docs/conf.py Outdated
Comment on lines +270 to +273
bundle_release = release
if napari_version.pre and napari_version.pre[0] in {'a', 'rc'}:
pre_label, pre_number = napari_version.pre
bundle_release = f'{napari_version.base_version}{pre_label}{pre_number}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For me this logic is not fixing pointed issue.

I think that we need to use function like this:

def get_latest_released_version(version_: packaging.version.Version) -> str:
    version_ = version_.__replace__(local=None)
    if not version_.is_devrelease:
        return str(version_)
    if version_.pre is None:
        # we are on path with no pre-release
        assert version_.micro > 0, "dev release must have micro > 0"
        return f'{version_.major}.{version_.minor}.{version_.micro - 1}'

    # we are on path with pre-release
    pre_label, pre_number = version_.pre
    return str(version_.__replace__(pre=(pre_label, pre_number - 1), dev=None))

Copy link
Copy Markdown
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Thanks @TimMonko

@Czaki
Copy link
Copy Markdown
Contributor

Czaki commented Apr 4, 2026

@willingc
Copy link
Copy Markdown
Contributor

willingc commented Apr 4, 2026

@TimMonko A general question. How would you feel about dev docs displaying the stable released bundle? Perhaps adding a comment that pre-release bundles may be found in GitHub releases page.

It may be less confusing for readers.

TimMonko and others added 3 commits April 4, 2026 14:59
@TimMonko TimMonko changed the title Fix bundle links for pre-release versions Use stable version for dev docs bundle links Apr 4, 2026
@TimMonko
Copy link
Copy Markdown
Contributor Author

TimMonko commented Apr 4, 2026

@TimMonko A general question. How would you feel about dev docs displaying the stable released bundle? Perhaps adding a comment that pre-release bundles may be found in GitHub releases page.

It may be less confusing for readers.

I switched it back to that, which is what Peter had implemented prior to my #958 .
There is, at L297 a reference to the releases page already :)
This should be ready to go now :)

@TimMonko TimMonko added this to the 0.7.1 milestone Apr 4, 2026
Czaki
Czaki previously requested changes Apr 4, 2026
Copy link
Copy Markdown
Contributor

@Czaki Czaki left a comment

Choose a reason for hiding this comment

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

Image

There is no 0.7.1 release yet.

Links should lead to 0.7.0 not 0.7.1

@TimMonko
Copy link
Copy Markdown
Contributor Author

TimMonko commented Apr 5, 2026

Woah thanks for looking at the build @Czaki , because locally I saw it correctly:
image

This did make me totally switch up the logic to what I think will work, but definitely need careful thought. I'll update PR description.

I also did add mention about pre-releases on the releases page on github, and not just earlier builds.

Edit:
CI Looks good
image


bundle_version = (
_stable_version_from_switcher()
if napari_version.is_prerelease
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if napari_version.is_prerelease
if napari_version.is_devrelease

napari==0.7.1a2 is prerelease, but not devrelease

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think with this current code we want 0.7.1a2 to point to 0.7.0, not the pre-release bundle (even though that was the original goal), so we want to use is_prerelease.

But you are right, if we do is_devrelease than I think 0.7.1a2 would point to the 0.7.1a2 bundle.

Can you confirm this logic?

Copy link
Copy Markdown
Contributor

@willingc willingc Apr 6, 2026

Choose a reason for hiding this comment

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

@TimMonko I believe that if you want to use the stable version to avoid confusion for end users (i.e. dev docs version will always display the stable bundle) then we should be using bundle_version is stable_version = _stable_version_from_switcher().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@willingc can you check the logic I have in the description? #973 (comment)
A new stable release would not have the version_switcher updated, so if we did just that then it would be one version behind on each stable release.
But, admittedly, my brain is struggling to wrap up the logic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are right, the getting version from switcher will provide wrong version during deploy stable docs.

And there are two paths. User is opening napari.org/dev then we might want to provide stable release.

But when user enter napari.org/0.7.1 when 0.7.1 is not released yet, but have some alpha or beta then it should link to latest bundle, even alpha one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have decided in today's docs meeting that we want the dev docs to always point to the latest stable release, not alphas or rcs.

@TimMonko TimMonko requested a review from Czaki April 9, 2026 22:43
@TimMonko TimMonko dismissed Czaki’s stale review April 9, 2026 22:43

the blocker is stale, opinion still welcome

@TimMonko TimMonko merged commit 19ce8b4 into napari:main Apr 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release should (sometimes?) point to latest when on dev version

4 participants