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

Enforce blank line after module docstring #1872

Closed
lsorber opened this issue Dec 16, 2020 · 2 comments · Fixed by #3932 · May be fixed by #3287
Closed

Enforce blank line after module docstring #1872

lsorber opened this issue Dec 16, 2020 · 2 comments · Fixed by #3932 · May be fixed by #3287
Labels
F: empty lines Wasting vertical space efficiently. T: style What do we want Blackened code to look like?

Comments

@lsorber
Copy link

lsorber commented Dec 16, 2020

Black does not have an opinion on whether there should be a blank line immediately after a module's docstring. This causes inconsistencies across blackened files because whatever the author chooses, stays.

Both examples below satisfy black:

"""Module docstring."""

import typing
"""Module docstring."""
import typing

My preference would be to enforce a blank line.

Related issue: #450

@lsorber lsorber added the T: style What do we want Blackened code to look like? label Dec 16, 2020
@JelleZijlstra
Copy link
Collaborator

Agree that we should add a blank line here.

@JelleZijlstra JelleZijlstra added C: cleanup Refactoring and removing dust :) F: empty lines Wasting vertical space efficiently. and removed C: cleanup Refactoring and removing dust :) labels May 30, 2021
@felix-hilden
Copy link
Collaborator

A moderate +1 for the proposal. To get a feel for multiline docstrings and some more imports:

"""
Multiline docstring.

That explains details about the module.
"""
import stuff
import antigravity

from __future__ import braces

# VS

"""
Multiline docstring.

That explains details about the module.
"""

import stuff
import antigravity

from __future__ import braces

I don't have a strong preference either way. Personally I don't add the empty line because the """ is enough of a separator, but that's not a hill I'm willing to die on 😄 I'd be happy with either 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: empty lines Wasting vertical space efficiently. T: style What do we want Blackened code to look like?
Projects
None yet
3 participants