Skip to content

Disable top-level docstring formatting for notebooks#9957

Merged
MichaReiser merged 3 commits intomainfrom
notebook-module-docstring
Feb 12, 2024
Merged

Disable top-level docstring formatting for notebooks#9957
MichaReiser merged 3 commits intomainfrom
notebook-module-docstring

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Feb 12, 2024

Summary

one can't access the module docstring for a notebook which makes a notebook not having a module level docstring. @dhruv

This PR handles strings at the top of a cell as non-docstrings. Handling them as docstrings has the undesired result that one might have multiple "docstrings" in a single notebook,
which is probably not what you want.

We don't need to gate this behind preview because it doesn't change any formatted code.

Test Plan

Added tests

@MichaReiser MichaReiser added formatter Related to the formatter notebook Related to (Jupyter) notebooks bug Something isn't working labels Feb 12, 2024
@MichaReiser MichaReiser enabled auto-merge (squash) February 12, 2024 18:08
@MichaReiser MichaReiser merged commit edfe842 into main Feb 12, 2024
@MichaReiser MichaReiser deleted the notebook-module-docstring branch February 12, 2024 18:14
@github-actions
Copy link
Contributor

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working formatter Related to the formatter notebook Related to (Jupyter) notebooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants