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

[MAINT] Bump version to 0.16.2dev0 #2137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peytondmurray
Copy link
Contributor

This PR fixes an issue with the locator in the test_version_switcher_highlighting test, which should allow #2133 to pass automated tests.

Note that this test is not run by CI, but that should be addressed in #2133. To test, please run this manually.

(Sorry about the extra PR - I don't have permissions to push to the branch in #2133). cc @trallard

Copy link

github-actions bot commented Feb 25, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/pydata_sphinx_theme
  __init__.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Collaborator

@drammock drammock left a comment

Choose a reason for hiding this comment

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

I'm not sure this is what we want to do. Reason: on our currently deployed dev site, the version switcher actually shows the wrong thing (it says "0.16.1 (stable)" even though the URL says .../latest/.... Seems like fixing that would make the existing test pass (and needs to get fixed anyway).

@peytondmurray
Copy link
Contributor Author

Ooh, so the actual issue is different than I thought. Let me put this back into draft and figure out what the actual root cause is.

@peytondmurray peytondmurray marked this pull request as draft February 25, 2025 23:05
@peytondmurray peytondmurray force-pushed the 2133-fix-playwright-test branch from 731c65a to 05e3f88 Compare February 26, 2025 02:18
@peytondmurray
Copy link
Contributor Author

peytondmurray commented Feb 26, 2025

So after looking into this more carefully, there's some logic in docs/conf.py around what the default version that gets displayed is in the version chooser:

# Define the version we use for matching in the version switcher.
version_match = os.environ.get("READTHEDOCS_VERSION")
release = pydata_sphinx_theme.__version__
# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
# If it is an integer, we're in a PR build and the version isn't correct.
# If it's "latest" → change to "dev" (that's what we want the switcher to call it)
if not version_match or version_match.isdigit() or version_match == "latest":
    # For local development, infer the version to match from the package.
    if "dev" in release or "rc" in release:
        version_match = "dev"
        # We want to keep the relative reference if we are in dev mode
        # but we want the whole url if we are effectively in a released version
        json_url = "_static/switcher.json"
    else:
        version_match = f"v{release}"
elif version_match == "stable":
    version_match = f"v{release}"

We never bumped the version after the last release to 0.16.2dev0. 👆 the logic above looks for the string "dev" in the current version, and if present, it sets this switcher["version_match"] value in the sphinx context, which tells the frontend to set that as the default. Since we never bumped the version, the frontend was considering the last release to be the default. After this change, the default value of the version chooser is dev:

image

@drammock What do you think of this fix? As far as I can tell there's nothing actually wrong in the version chooser code otherwise, though it's maybe not the way I'd have done it.

If we're tired of bumping these numbers by hand, we could always use setuptools_scm or similar tools to handle version number bumping/tie versions to git releases.

@drammock
Copy link
Collaborator

We never bumped the version after the last release to 0.16.2dev0.

Glad to hear the problem is that simple to fix! IIRC it's not the first time the bump has been missed after a release, so:

If we're tired of bumping these numbers by hand, we could always use setuptools_scm or similar tools to handle version number bumping/tie versions to git releases.

Yes please. It's already on my mental backlog of improvements that I wanted to suggest if we ever got caught up with the actual issue backlog

As far as I can tell there's nothing actually wrong in the version chooser code otherwise, though it's maybe not the way I'd have done it.

I'd be open to revisiting the switcher code if you have ideas. It seems to be perpetually unable to satisfy the use cases or workflow preferences of all users.

@peytondmurray
Copy link
Contributor Author

Cool, let's merge this and I can make another issue for investigating automatic version bumping.

@peytondmurray peytondmurray marked this pull request as ready for review February 26, 2025 04:09
@peytondmurray peytondmurray changed the title [BUG] Fix locator in version-switcher highlighting playwright test [BUG] Bump version to 0.16.2dev0 Feb 26, 2025
@peytondmurray peytondmurray changed the title [BUG] Bump version to 0.16.2dev0 [MAINT] Bump version to 0.16.2dev0 Feb 26, 2025
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.

2 participants