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

Feature/25 integrate notebooks into docu #149

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

MarcoHuebner
Copy link
Collaborator

@MarcoHuebner MarcoHuebner commented Sep 18, 2024

  • update conf, index and deployment workflow to add notebooks to docu
  • update dependencies
  • adapt pre-commit hook: Remove step local documentation building

Addresses #25

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced documentation deployment process with the addition of Pandoc installation and improved notebook integration.
    • Added support for Jupyter Notebooks in documentation through the nbsphinx extension.
  • Documentation

    • Updated README to clarify prerequisites for building documentation locally.
    • Introduced a new table of contents for notebooks in the documentation index for better navigation.
  • Bug Fixes

    • Improved formatting and readability in the Geo-Visualization Example Notebook.

Copy link

coderabbitai bot commented Sep 18, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes primarily enhance the documentation deployment process by updating the workflow configuration, removing outdated pre-commit hooks, and modifying documentation files. Key updates include the installation of Pandoc, integration of Jupyter Notebooks via the nbsphinx extension, and improved organization of the documentation index. Additionally, formatting updates were made to a specific notebook to enhance readability. A new dependency for nbsphinx was also added to the project configuration.

Changes

File Change Summary
.github/workflows/deploy-docs.yaml Added steps to install Pandoc, clear existing notebook directory, and copy new notebook files for documentation deployment.
.pre-commit-config.yaml Removed the build-docs hook related to Sphinx documentation compilation.
README.md Updated instructions for local documentation build to include Pandoc installation prerequisites.
docs/source/conf.py Added nbsphinx extension and set nbsphinx_execute option to "never" to control notebook execution during builds.
docs/source/index.rst Introduced a new section with a table of contents for notebooks to enhance documentation organization.
nb/02_Geo_visualization_example.ipynb Reformatted markdown cells for improved readability; no changes to code or functionality.
pyproject.toml Added nbsphinx dependency with version ^0.9.5 to support Jupyter Notebooks in documentation.

Poem

🐰 In the garden of code, we hop and play,
With Pandoc and notebooks, we brighten the day.
Our docs now are tidy, with nbsphinx in tow,
A leap into clarity, watch our knowledge grow!
So gather 'round, friends, let’s share and delight,
In the world of our project, everything feels right! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.30%. Comparing base (1dcd903) to head (3912f89).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #149   +/-   ##
=======================================
  Coverage   81.30%   81.30%           
=======================================
  Files          11       11           
  Lines         551      551           
=======================================
  Hits          448      448           
  Misses        103      103           

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

@pmayd
Copy link
Collaborator

pmayd commented Sep 19, 2024

@coderabbitai full review

Copy link

coderabbitai bot commented Sep 19, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range and nitpick comments (1)
.github/workflows/deploy-docs.yaml (1)

39-43: Simplify directory removal by removing the conditional check

Since rm -rf will not raise an error if the directory does not exist, you can simplify the script by removing the if condition.

Apply this diff to simplify the code:

       - name: Remove existing nb directory
-        run: |
-          if [ -d "docs/source/nb" ]; then
-            rm -rf docs/source/nb
-          fi
+        run: rm -rf docs/source/nb
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1dcd903 and e7f1371.

Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (7)
  • .github/workflows/deploy-docs.yaml (1 hunks)
  • .pre-commit-config.yaml (0 hunks)
  • README.md (1 hunks)
  • docs/source/conf.py (2 hunks)
  • docs/source/index.rst (1 hunks)
  • nb/02_Geo_visualization_example.ipynb (12 hunks)
  • pyproject.toml (1 hunks)
Files not reviewed due to no reviewable changes (1)
  • .pre-commit-config.yaml
Files skipped from review due to trivial changes (2)
  • README.md
  • nb/02_Geo_visualization_example.ipynb
Additional comments not posted (4)
docs/source/index.rst (1)

25-35: LGTM!

The addition of the notebooks section in the documentation index is correctly formatted, and the entries are properly listed.

docs/source/conf.py (2)

31-31: Addition of nbsphinx extension is appropriate

Including "nbsphinx" in the extensions list enables Jupyter Notebook support in your Sphinx documentation, which is beneficial for integrating notebooks seamlessly.


40-40: Verify that nbsphinx_execute = "never" meets your documentation requirements

Setting nbsphinx_execute = "never" will prevent the execution of code cells during the documentation build process. Consequently, the outputs displayed in the documentation will be those already saved in the notebook files. Ensure that all notebooks have the desired outputs pre-executed and saved to provide a complete and informative documentation experience.

pyproject.toml (1)

66-66: Addition of nbsphinx dependency looks good

The inclusion of nbsphinx = "^0.9.5" enhances the documentation by enabling integration of Jupyter Notebooks, aligning with the PR objectives.

.github/workflows/deploy-docs.yaml Outdated Show resolved Hide resolved
.github/workflows/deploy-docs.yaml Outdated Show resolved Hide resolved
Copy link

coderabbitai bot commented Sep 19, 2024

Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (3)
docs/source/index.rst (1)

Line range hint 1-58: Consider adding brief descriptions for each notebook entry.

To further enhance the usability and clarity of the documentation, consider adding a brief one-line description for each notebook entry in the table of contents. This will give users a quick overview of the purpose and content of each notebook without having to navigate to the actual notebook file.

For example:

   nb/00_Setup
+   Setup and configuration of the pystatis environment
   nb/01_table
+   Creating and manipulating tables using pystatis
   nb/02_Geo_visualization_example
+   Examples and tutorials for geographical visualizations
   nb/03_find
+   Finding and querying data using pystatis
   nb/04_jobs
+   Job-related functionalities and workflows
   nb/05_presentation
+   Presentation and visualization techniques using pystatis

These brief descriptions will provide users with a quick understanding of what each notebook covers, making it easier for them to identify the notebook that best suits their needs.

docs/source/conf.py (1)

Line range hint 1-58: Consider adding a brief comment about the purpose of the nbsphinx extension.

To enhance the maintainability and readability of the configuration file, it would be helpful to add a concise comment explaining the purpose of the nbsphinx extension. This will provide clarity for future maintainers and contributors.

Here's a suggested comment to add above the nbsphinx extension:

extensions = [
+    # nbsphinx: Enables integration of Jupyter Notebooks into Sphinx documentation
    "nbsphinx",
    "myst_parser",
    "sphinx.ext.autodoc",
    "sphinx.ext.autosummary",  # used to generate overview tables
    "sphinx.ext.napoleon",  # used for google-style docstrings
]
.github/workflows/deploy-docs.yaml (1)

39-43: Simplify the directory removal step.

Instead of checking for the existence of the directory and then removing it, you can use the -p flag with rm to remove the directory and its contents only if it exists. This simplifies the step and reduces the number of lines needed.

Apply this diff to simplify the directory removal step:

-      - name: Remove existing nb directory
-        run: |
-          if [ -d "docs/source/nb" ]; then
-            rm -rf docs/source/nb
-          fi
+      - name: Remove existing nb directory if it exists
+        run: rm -rf docs/source/nb
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1dcd903 and e7f1371.

Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (7)
  • .github/workflows/deploy-docs.yaml (1 hunks)
  • .pre-commit-config.yaml (0 hunks)
  • README.md (1 hunks)
  • docs/source/conf.py (2 hunks)
  • docs/source/index.rst (1 hunks)
  • nb/02_Geo_visualization_example.ipynb (12 hunks)
  • pyproject.toml (1 hunks)
Files not reviewed due to no reviewable changes (1)
  • .pre-commit-config.yaml
Additional comments not posted (6)
nb/02_Geo_visualization_example.ipynb (1)

7-8: LGTM!

The formatting changes enhance the readability and visual structure of the notebook without altering the content or functionality. The addition of underlines beneath titles and section headers improves clarity and emphasis. Removing unnecessary line breaks in markdown cells streamlines the presentation.

Also applies to: 12-14, 41-42, 63-64, 253-259, 307-313, 456-457, 464-465, 679-680, 762-763, 884-890, 1065-1066, 1297-1298, 1311-1312, 1436-1436

docs/source/index.rst (2)

25-35: Excellent addition of the Notebooks section!

The new Notebooks section in the documentation index significantly improves the organization and discoverability of the notebooks. The clear categorization and intuitive naming of the notebook entries will greatly benefit users in navigating and locating the relevant notebooks for their needs.

The use of a maximum depth of 2 for the table of contents is also a good choice, as it provides a balance between providing an overview of the available notebooks and maintaining a concise structure.

Overall, this is a valuable enhancement to the documentation structure.


Line range hint 1-58: Verify the notebook file paths and names.

Please ensure that the notebook file paths and names mentioned in the table of contents match the actual notebook files in the repository. It's important to double-check that the referenced notebooks exist at the specified locations to avoid broken links or missing content in the documentation.

Run the following script to verify the notebook file paths:

Verification successful

This script will list all .ipynb files in the 'nb' directory, show the list from the documentation, and then compare the two lists. If there are any differences, they will be displayed by the diff command.


Notebook file paths and names verified successfully

The verification process has confirmed that all notebook files mentioned in the table of contents exist in the 'nb' directory, and there are no additional notebooks that are not listed in the documentation. The paths and names in the documentation accurately reflect the actual files in the repository.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the notebook files referenced in the table of contents exist.

# Test: Check if each notebook file exists. Expect: All files to be found.
notebooks=(
  "nb/00_Setup.ipynb"
  "nb/01_table.ipynb"
  "nb/02_Geo_visualization_example.ipynb"
  "nb/03_find.ipynb"
  "nb/04_jobs.ipynb"
  "nb/05_presentation.ipynb"
)

for notebook in "${notebooks[@]}"; do
  if [ ! -f "$notebook" ]; then
    echo "Notebook file not found: $notebook"
    exit 1
  fi
done

echo "All notebook files exist."

Length of output: 670


Script:

#!/bin/bash
# Description: List all .ipynb files in the 'nb' directory and compare with the documented list

# List all .ipynb files in the 'nb' directory
echo "Notebooks found in the 'nb' directory:"
find nb -name "*.ipynb" | sort

echo -e "\nNotebooks listed in the documentation:"
cat << EOF
nb/00_Setup.ipynb
nb/01_table.ipynb
nb/02_Geo_visualization_example.ipynb
nb/03_find.ipynb
nb/04_jobs.ipynb
nb/05_presentation.ipynb
EOF

echo -e "\nComparing the lists:"
diff <(find nb -name "*.ipynb" | sort) <(cat << EOF
nb/00_Setup.ipynb
nb/01_table.ipynb
nb/02_Geo_visualization_example.ipynb
nb/03_find.ipynb
nb/04_jobs.ipynb
nb/05_presentation.ipynb
EOF
)

Length of output: 706

docs/source/conf.py (2)

31-31: Excellent addition of the nbsphinx extension!

The nbsphinx extension is a great choice for integrating Jupyter Notebooks into the Sphinx documentation. It allows seamless inclusion and rendering of notebook content within the documentation.


40-40: Good configuration choice for nbsphinx_execute.

Setting nbsphinx_execute to "never" is a wise decision. It ensures that code cells in the notebooks are not executed during the documentation build process. This has several benefits:

  1. Improved build performance by avoiding unnecessary code execution.
  2. Eliminates dependencies on the notebook execution environment.
  3. Ensures consistent documentation generation regardless of potentially variable code.
README.md (1)

198-198: Clarify the prerequisite for building documentation locally.

The added text provides clear instructions on the necessity of having pandoc installed before running the command to build the documentation locally. It includes a link to the installation instructions and an example command using conda for installation.

This change improves the clarity and usability of the documentation by explicitly stating the prerequisite.

pyproject.toml Show resolved Hide resolved
@MarcoHuebner
Copy link
Collaborator Author

Built documentation can be found at https://correlaid.github.io/pystatis/dev/index.html

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