Skip to content

module_docstring_newlines inconsistent with black #20496

@Redoubts

Description

@Redoubts

Summary

Not sure if this is on you or black, but consider

#!/python
"""
docstring
"""
from __future__ import annotations

import os

if I use black on this file, it stays unchanged. If I use ruff format, a newline is added after the docstring. If I remove the shebang, black will add the newline.

Who's right?

Version

ruff 0.13.1 vs black, 25.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    formatterRelated to the formatterquestionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions