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

fix: fix multi-package with nav #10

Merged
merged 1 commit into from
Feb 28, 2025
Merged

fix: fix multi-package with nav #10

merged 1 commit into from
Feb 28, 2025

Conversation

tlambert03
Copy link
Owner

This fixes #9, a bug that showed up with using multiple top level modules (modules: ["src/package1", "src/package2"]) while also providing a nav entry

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @tlambert03, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request addresses a bug where using multiple top-level modules with a nav entry would cause issues. The fix involves modifying the _merge_nav function in src/mkdocs_api_autonav/plugin.py to correctly handle the merging of navigation configurations when multiple modules are specified. Additionally, the pull request includes updates to the test suite to cover this specific scenario and adds pdbpp to the development dependencies.

Highlights

  • Bug Fix: Fixes a bug that occurred when using multiple top-level modules with a nav entry, as reported in issue Multiple modules crash MkDocs #9.
  • Navigation Merging: Modifies the _merge_nav function to correctly merge navigation configurations in multi-module setups.
  • Test Coverage: Adds a new test case (test_multi_package) to specifically test the multi-module scenario.
  • Development Dependencies: Adds pdbpp (pdb++) to the development dependencies for enhanced debugging capabilities.

Changelog

Click here to see the changelog
  • pyproject.toml
    • Added pdbpp to the list of development dependencies.
  • src/mkdocs_api_autonav/plugin.py
    • Modified the _merge_nav function to correctly handle navigation merging when multiple top-level modules are used.
    • Removed unnecessary list conversion when assigning the nav dictionary.
    • Added logic to extend the navigation list with individual key-value pairs from the navigation dictionary when the dictionary has more than one entry.
  • tests/test_mkdocs_api_autonav.py
    • Added a new test case (test_multi_package) to verify the fix for multi-module setups.
    • Refactored test_build_with_nav to use NAV_CASES and include a strict parameter for more comprehensive testing.
    • Added new test cases to NAV_CASES to cover different navigation configurations.
  • uv.lock
    • Updated dependencies, including coverage, decorator, griffe, identify, ipython, mkdocs-autorefs, mkdocstrings, mkdocstrings-python, pyright, and ruff.
    • Added fancycompleter, pdbpp, pyreadline, and pyrepl as new dependencies.
    • Modified dependency markers for ipython and importlib-metadata based on Python version.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

YAML, the format used for MkDocs configuration, stands for "YAML Ain't Markup Language". It's a human-readable data-serialization language often used for configuration files and in applications where data is being stored or transmitted.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request addresses a bug related to multi-package configurations with navigation in the mkdocs-api-autonav plugin. The changes include fixes to the navigation merging logic and the addition of a test case to cover the multi-package scenario. The dependency updates in uv.lock and pyproject.toml seem reasonable.

Summary of Findings

Merge Readiness

The pull request appears to address the reported bug effectively. The changes to the navigation merging logic in src/mkdocs_api_autonav/plugin.py seem correct, and the addition of the test_multi_package test case in tests/test_mkdocs_api_autonav.py provides confidence in the fix. I am unable to approve the pull request, and recommend that others review and approve this code before merging.

Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f6a2514) to head (05890bd).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #10   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          123       125    +2     
=========================================
+ Hits           123       125    +2     

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

@tlambert03 tlambert03 merged commit d61e327 into main Feb 28, 2025
14 checks passed
@tlambert03 tlambert03 deleted the fix-multi-package branch February 28, 2025 18:13
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.

Multiple modules crash MkDocs
1 participant