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

Use PyData Sphinx theme version switcher #46936

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

cristianjd
Copy link
Collaborator

@cristianjd cristianjd commented Aug 2, 2024

Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that we have more control of it's location and the ordering of the versions.

  • added the version switcher to the navbar
  • pointed the versions to the recently added versions.json and the selected version to the version set by read the docs
  • styling to limit the height of the version switcher and allow for scrolling to see more
  • styling to suppress the RTD version switcher
Screenshot 2024-08-02 at 10 46 45 AM

Related issue number

Closes #46382
Closes #46189

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@cristianjd cristianjd requested a review from a team as a code owner August 2, 2024 18:05
Copy link
Collaborator

@can-anyscale can-anyscale left a comment

Choose a reason for hiding this comment

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

wow so cool, i'll wait a bit for the readsthedoc to build but this is looking great

@can-anyscale
Copy link
Collaborator

in the screen shot though, some versions (releases/2.33.0) are duplicated, are they intended?

@cristianjd
Copy link
Collaborator Author

@can-anyscale good eyes. def not intended. will get a fix up

@cristianjd cristianjd force-pushed the cristian/version-switcher-pt-2 branch from 2c80e26 to 72ae47e Compare August 2, 2024 18:37
@cristianjd
Copy link
Collaborator Author

Fixed duplicate versions issue by updating the JSON generation logic do not include tags with the ^{} suffix.

JSON Before:
Screenshot 2024-08-02 at 11 25 41 AM

JSON After:
Screenshot 2024-08-02 at 11 28 33 AM

Note that the RTD build won't have this reflected since the build is pointing to the JSON from master

Copy link
Contributor

@angelinalg angelinalg left a comment

Choose a reason for hiding this comment

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

looks so great! Thank you!!!!

@can-anyscale can-anyscale enabled auto-merge (squash) August 2, 2024 20:37
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Aug 2, 2024
@can-anyscale can-anyscale enabled auto-merge (squash) August 2, 2024 20:37

/* Prevent the the PyData theme Version Switcher from getting too large */
.version-switcher__menu {
max-height: 496px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to use a relative unit here so it scales with the user's font size.

@@ -1261,6 +1261,7 @@ def pregenerate_example_rsts(
repo_url = "https://github.com/ray-project/ray.git"
static_dir_name = "_static"
version_json_filename = "versions.json"
dereference_suffix = "^{}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I missed this change before - do we need these to be defined at the module level and not in the function that uses them? We really don't want to pollute the module namespace if we can avoid it, and as far as I can tell these are only being used in generate_versions_json.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will raise a follow up PR to address this since this one got merged. Thanks!

@can-anyscale can-anyscale merged commit 3bc5df5 into master Aug 2, 2024
8 checks passed
@can-anyscale can-anyscale deleted the cristian/version-switcher-pt-2 branch August 2, 2024 21:35
cristianjd added a commit that referenced this pull request Aug 8, 2024
## Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that
we have more control of it's location and the ordering of the versions.
- added the version switcher to the navbar
- pointed the versions to the recently added `versions.json` and the
selected version to the `version` set by read the docs
- styling to limit the height of the version switcher and allow for
scrolling to see more
- styling to suppress the RTD version switcher

<img width="646" alt="Screenshot 2024-08-02 at 10 46 45 AM"
src="https://github.com/user-attachments/assets/00836b9f-5c2b-40ed-ab70-e0175ade8d0a">


## Related issue number
Closes #46382
Closes #46189


Signed-off-by: cristianjd <[email protected]>
cristianjd added a commit that referenced this pull request Aug 8, 2024
## Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that
we have more control of it's location and the ordering of the versions.
- added the version switcher to the navbar
- pointed the versions to the recently added `versions.json` and the
selected version to the `version` set by read the docs
- styling to limit the height of the version switcher and allow for
scrolling to see more
- styling to suppress the RTD version switcher

<img width="646" alt="Screenshot 2024-08-02 at 10 46 45 AM"
src="https://github.com/user-attachments/assets/00836b9f-5c2b-40ed-ab70-e0175ade8d0a">


## Related issue number
Closes #46382
Closes #46189


Signed-off-by: cristianjd <[email protected]>
cristianjd added a commit that referenced this pull request Aug 8, 2024
## Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that
we have more control of it's location and the ordering of the versions.
- added the version switcher to the navbar
- pointed the versions to the recently added `versions.json` and the
selected version to the `version` set by read the docs
- styling to limit the height of the version switcher and allow for
scrolling to see more
- styling to suppress the RTD version switcher

<img width="646" alt="Screenshot 2024-08-02 at 10 46 45 AM"
src="https://github.com/user-attachments/assets/00836b9f-5c2b-40ed-ab70-e0175ade8d0a">


## Related issue number
Closes #46382
Closes #46189


Signed-off-by: cristianjd <[email protected]>
cristianjd added a commit that referenced this pull request Aug 8, 2024
## Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that
we have more control of it's location and the ordering of the versions.
- added the version switcher to the navbar
- pointed the versions to the recently added `versions.json` and the
selected version to the `version` set by read the docs
- styling to limit the height of the version switcher and allow for
scrolling to see more
- styling to suppress the RTD version switcher

<img width="646" alt="Screenshot 2024-08-02 at 10 46 45 AM"
src="https://github.com/user-attachments/assets/00836b9f-5c2b-40ed-ab70-e0175ade8d0a">


## Related issue number
Closes #46382
Closes #46189


Signed-off-by: cristianjd <[email protected]>
cristianjd added a commit that referenced this pull request Aug 8, 2024
## Why are these changes needed?

This switches to using the PyData Sphinx theme version switcher so that
we have more control of it's location and the ordering of the versions.
- added the version switcher to the navbar
- pointed the versions to the recently added `versions.json` and the
selected version to the `version` set by read the docs
- styling to limit the height of the version switcher and allow for
scrolling to see more
- styling to suppress the RTD version switcher

<img width="646" alt="Screenshot 2024-08-02 at 10 46 45 AM"
src="https://github.com/user-attachments/assets/00836b9f-5c2b-40ed-ab70-e0175ade8d0a">


## Related issue number
Closes #46382
Closes #46189


Signed-off-by: cristianjd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
4 participants