Skip to content

Override line-length for subdirectories #1370

@aklajnert

Description

@aklajnert

Currently, black allows changing the line length globally via pyproject.toml or with the --line-length argument. This setting is global for the whole directory tree.

In my project, I have a docs/examples directory, which contains python files, that are shown in the documentation by using the literalinclude directive. While for most of the project the global line length setting (100) is fine, for the examples it's too wide and requires the horizontal scroll bar to display the code samples.

I've tried to add another pyproject.toml file in the docs/examples directory, but it is respected only when I'll execute black from that directory. It's hard to use it from pre-commit hooks.

Is there any way to override the line length for subdirectories?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions