Skip to content

Conversation

@chaoming0625
Copy link
Member

@chaoming0625 chaoming0625 commented Oct 6, 2025

Summary by Sourcery

Standardize Read the Docs builds by using a symlinked docs_build directory to handle multiple documentation versions

Enhancements:

  • Add post_checkout job in .readthedocs.yml to symlink version-specific docs into a unified docs_build directory
  • Point Sphinx configuration to docs_build/conf.py instead of a static docs path
  • Remove the now-obsolete docs_version2/.readthedocs.yml file

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 6, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR enhances the Read the Docs configuration by introducing a conditional post_checkout job that symlinks the appropriate docs directory for versioned builds, updates the Sphinx configuration path to use the new symlink, and removes the obsolete version-specific RTD config file.

Flow diagram for symbolic link setup in Read the Docs config

flowchart TD
    Start([Start build]) --> CheckVersion{"$PROJECT_VERSION = brainpy-version2?"}
    CheckVersion -- Yes --> SymlinkV2["Symlink docs_version2 to docs_build"]
    CheckVersion -- No --> SymlinkDefault["Symlink docs to docs_build"]
    SymlinkV2 --> SphinxBuild["Run Sphinx on docs_build/conf.py"]
    SymlinkDefault --> SphinxBuild
Loading

File-Level Changes

Change Details Files
Added post_checkout job to dynamically create a symlink for the documentation directory based on project version
  • Introduced build.jobs.post_checkout section
  • Added shell logic to link docs_build to docs_version2 or docs
.readthedocs.yml
Updated Sphinx configuration to reference the new symlinked docs directory
  • Changed sphinx.configuration to use docs_build/conf.py
  • Updated accompanying build comment to reflect symlink usage
.readthedocs.yml
Removed outdated Read the Docs config for version 2 docs
  • Deleted the legacy version-specific RTD configuration file
docs_version2/.readthedocs.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chaoming0625 chaoming0625 merged commit 5ff8f9d into master Oct 6, 2025
10 of 18 checks passed
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `.readthedocs.yml:15-20` </location>
<code_context>
+      # Set up symbolic link based on RTD project name
+      - |
+        if [ "$PROJECT_VERSION" = "brainpy-version2" ]; then
+          ln -sf docs_version2 docs_build
+        else
+          ln -sf docs docs_build
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Check for existence of target before creating symlink.

If docs_build is an existing directory, overwriting it with ln -sf may cause build issues. Please check and remove docs_build if necessary before creating the symlink.

```suggestion
      - |
        # Remove docs_build if it exists (directory or symlink)
        if [ -e docs_build ]; then
          rm -rf docs_build
        fi
        if [ "$PROJECT_VERSION" = "brainpy-version2" ]; then
          ln -s docs_version2 docs_build
        else
          ln -s docs docs_build
        fi
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +15 to +20
- |
if [ "$PROJECT_VERSION" = "brainpy-version2" ]; then
ln -sf docs_version2 docs_build
else
ln -sf docs docs_build
fi
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): Check for existence of target before creating symlink.

If docs_build is an existing directory, overwriting it with ln -sf may cause build issues. Please check and remove docs_build if necessary before creating the symlink.

Suggested change
- |
if [ "$PROJECT_VERSION" = "brainpy-version2" ]; then
ln -sf docs_version2 docs_build
else
ln -sf docs docs_build
fi
- |
# Remove docs_build if it exists (directory or symlink)
if [ -e docs_build ]; then
rm -rf docs_build
fi
if [ "$PROJECT_VERSION" = "brainpy-version2" ]; then
ln -s docs_version2 docs_build
else
ln -s docs docs_build
fi

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 6, 2025
@chaoming0625 chaoming0625 deleted the fix branch October 7, 2025 11:53
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.

3 participants