Skip to content

feat: allow force_inspection option to be configurable #231

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

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

elfkuzco
Copy link
Contributor

@elfkuzco elfkuzco commented Jan 23, 2025

Add force_inspection flag to PythonHandler for mkdocs.yml configuration

Rationale

The force_inspection argument cannot be configured directly via mkdocs.yml. This change introduces a straightforward way to pass the option by forwarding it to the GriffeLoader.

Changes

  • Added force_inspection to PythonHandler.default_config with a default value of False.
  • Forwarded the force_inspection value to the GriffeLoader constructor.

Fixes #94

@elfkuzco elfkuzco changed the title feat: allow option to be configurable feat: allow force_inspection option to be configurable Jan 23, 2025
@pawamoy
Copy link
Member

pawamoy commented Jan 23, 2025

Hi @elfkuzco, thank you so much for the PR! I have edited the body to mention that it fixes #94 🙂

Could you revert the style changes? It looks like your IDE formatted the code with a 80 width. You can run make vscode within the repository to make sure the editor is configured properly for the project. If you're using another editor, just make sure it uses 120 width for Ruff.

@elfkuzco
Copy link
Contributor Author

Hi @elfkuzco, thank you so much for the PR! I have edited the body to mention that it fixes #94 🙂

Could you revert the style changes? It looks like your IDE formatted the code with a 80 width. You can run make vscode within the repository to make sure the editor is configured properly for the project. If you're using another editor, just make sure it uses 120 width for Ruff.

Oh, I am glad it resolves another issue. I only stumbled on it while working on an issue on another project and this seemed to be the easiest way. Should I set [tool.ruff] settings in the pyproject.toml file too?

@elfkuzco elfkuzco force-pushed the allow-force-inspection branch from 88ab0d9 to ac1cfa4 Compare January 23, 2025 22:04
@pawamoy
Copy link
Member

pawamoy commented Jan 23, 2025

Should I set [tool.ruff] settings in the pyproject.toml file too?

No, our Ruff config is in config/ruff.toml. Running make vscode will point VSCode at it. Running make format also uses it 🙂 We just want to avoid formatting with default rules here.

@elfkuzco
Copy link
Contributor Author

Should I set [tool.ruff] settings in the pyproject.toml file too?

No, our Ruff config is in config/ruff.toml. Running make vscode will point VSCode at it. Running make format also uses it 🙂 We just want to avoid formatting with default rules here.

I actually use Vim and not VSCode. I added the line-length to my local pyproject.toml (but didn't add it to the changes) and while it reverts some of the changes in this file, it leaves some as it is. I tried copying the changes and pasting them back but it keeps fixing them. Even some of the lines with noqa

@pawamoy
Copy link
Member

pawamoy commented Jan 23, 2025

Well I'd recommend disabling auto-formatting for this project then. Or configuring Vim so it runs Ruff with --config config/ruff.toml.

@elfkuzco elfkuzco force-pushed the allow-force-inspection branch from ac1cfa4 to bc51394 Compare January 23, 2025 22:36
@elfkuzco
Copy link
Contributor Author

Well I'd recommend disabling auto-formatting for this project then. Or configuring Vim so it runs Ruff with --config config/ruff.toml.

Okay. Looks good now.

@pawamoy
Copy link
Member

pawamoy commented Jan 23, 2025

Thank you! I've merged main to fix CI, and also added a docs entry for the new option.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

LGTM, thank you very much @elfkuzco!

@pawamoy pawamoy merged commit 83823be into mkdocstrings:main Jan 23, 2025
26 checks passed
viktorlashchuk added a commit to viktorlashchuk/mkdocstrings-python that referenced this pull request Feb 24, 2025
Griffe supports this option but mkdocstrings-python didn't allow users to configure it.

Issue-94: mkdocstrings/python#94
PR-231: mkdocstrings/python#231
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.

Force inspection
2 participants