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

PR 1/2: Add versioned docs #509

Merged
merged 9 commits into from
Sep 7, 2024
Merged

Conversation

till-m
Copy link
Member

@till-m till-m commented Jul 26, 2024

Fix #504

Demo: https://till-m.github.io/BayesianOptimization/

This adds a version dropdown to our docs page. In the future, any new release will be added to this version dropdown automatically. Similarly, it will keep an updated version of the master docs.

I had to switch to sphinx-immaterial to get this to work. I’ve also cleaned up the docs a bit and made everything look nicer (imo).

I've also trimmed the README significantly.

How does it work?

There’s a workflow that runs on push (master), pull request and release. This workflow does a number of things.

1) build-docs-and-publish

  1. It builds the docs (to use but also to check whether they actually build).
  2. It determines the current state of the git ref and sets a target variable accordingly.
    1. If running on master, set target to master
    2. If running on a release, set target to release version
    3. If running due to PR, set target to empty string
  3. If the target is not empty string, it deploys the html folder of the built docs to gh-pages/<target>. It overwrites anything in <target> but ignores any other content in gh-pages

2) Update docs versions JSON

Only runs if the target is not empty

  1. Clones the gh-pages branch and reads out the folders within (ignoring anything starting with .)
  2. Reads out the folder names, determines which are referring to versions and which not.
  3. Finds the maximum version
  4. Generates a JSON object encoding the present folders/version and the maximum version
  5. Pushes that JSON file to the gh-pages (ignoring any other files in the branch).

When you open the docs page, the landing page reads out the versions.json and redirects you to stable. If there is no version tagged stable, it will redirect to master.

On merging this

Requires a sister PR to be merged first, prepping the gh-pages branch: #510

I’ve purged the gh-pages branch and added docs for the v1.5.1 release. This way I could a) test the publish workflow, b) ensure that there is a stable version present, c) make persistent docs for v.1.5.1 and d) have a more functional demo.

Credit

Based on github.com/brechtm/rinohtype's workflow.

till-m and others added 2 commits July 26, 2024 19:43
* versioned docs@1.5.1

* Don't trigger publish if target is empty

* Set workflow to trigger on release

* Fix: versions.json path
@till-m till-m requested review from fmfn and bwheelz36 July 26, 2024 18:20
@till-m
Copy link
Member Author

till-m commented Jul 26, 2024

@phi-friday I will put your PRs on hold until this is sorted out, because any merge conflict on gh-pages would be horrible to resolve. My apologies.

@phi-friday
Copy link
Contributor

@phi-friday I will put your PRs on hold until this is sorted out, because any merge conflict on gh-pages would be horrible to resolve. My apologies.

I'm sorry I can't help you with that, I'm not familiar with the documentation.

I looked at the link you showed as an example and it seems to be better in accessibility,
like dark mode support and clipboard support, so good luck with that.

PR checks are always welcome.

@phi-friday
Copy link
Contributor

The code_docs looks like it needs some work.
The variable name and type are not separated by a space.

스크린샷 2024-07-27 오후 12 54 50

@phi-friday
Copy link
Contributor

phi-friday commented Jul 27, 2024

The code_docs looks like it needs some work. The variable name and type are not separated by a space.

When written like pbounds: dict, it looks fine,
but when written like pbounds : dict, the spaces disappear.

스크린샷 2024-07-27 오후 1 25 15
스크린샷 2024-07-27 오후 1 25 20

@till-m
Copy link
Member Author

till-m commented Jul 27, 2024

Technically adding a space before the colon is the correct version, as specififed in the numpydoc style guide.
Related: ruff feature request for this rule: astral-sh/ruff#8425

@till-m
Copy link
Member Author

till-m commented Jul 27, 2024

I raised an issue about this at jbms/sphinx-immaterial#375

Copy link

codecov bot commented Jul 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.18%. Comparing base (abdd535) to head (c085670).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #509      +/-   ##
==========================================
+ Coverage   94.70%   96.18%   +1.47%     
==========================================
  Files           9       10       +1     
  Lines         680      864     +184     
==========================================
+ Hits          644      831     +187     
+ Misses         36       33       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@till-m
Copy link
Member Author

till-m commented Jul 28, 2024

Fixed by adding an extension! Link (master only)!

I will backport this fix along with any other changes requested to the v1.5.1 commit once this PR is approved. Until then, I'm marking #510 as a draft.

Before/1.5.1:
Screenshot 2024-07-28 at 09 48 13

After/master:
Screenshot 2024-07-28 at 09 47 48

@till-m
Copy link
Member Author

till-m commented Aug 9, 2024

Added a warning to the .maximize docstring to cover #513.

@till-m
Copy link
Member Author

till-m commented Aug 20, 2024

I backported all configuration changes to the v1.5.1 documentation (e.g. the numpydocs codestyle). From my side, this PR is good to go -- there's nothing I feel the need to change at this stage.

See the demo here.

@fmfn @bwheelz36 I would appreciate if you find a chance to review this. Given that the docs are in a sense the face of this project, I want to make sure no one is unhappy with the outcome.

@till-m till-m merged commit 2bf4edd into bayesian-optimization:master Sep 7, 2024
11 checks passed
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.

Docs: Deploy Multiple Versions
2 participants