Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Some fields ignore column-width #26

@henryiii

Description

@henryiii

If you set column-width, some fields ignore it and get rewritten anyway. It should be noted that column-width does seem to respect trailing commas, so a = [ "b",\n] is kept even if it's set. (Also, I think it should be clarified in the docs that the column width is in characters, not entries).

Before:

[build-system]
build-backend = "hatchling.build"
requires = [ "hatchling" ]

[project]
keywords = [ "package" ]
authors = [ { name = "Kitware" } ]
dynamic = [ "version" ]
dependencies = [ "sphinx" ]

[tool.hatch]
build.targets.wheel.packages = [ "sphinxcontrib" ]

[tool.pytest.ini_options]
testpaths = [ "tests" ]

[tool.pyproject-fmt]
column_width = 80

After:

[build-system]
build-backend = "hatchling.build"
requires = [
  "hatchling",
]

[project]
keywords = [
  "package",
]
authors = [ { name = "Kitware" } ]
classifiers = [
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.8",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dynamic = [
  "version",
]
dependencies = [
  "sphinx",
]

[tool.hatch]
build.targets.wheel.packages = [ "sphinxcontrib" ]

[tool.pyproject-fmt]
column_width = 80

[tool.pytest.ini_options]
testpaths = [ "tests" ]

This does seem to be happening on sorted fields. I think the presence of the trailing comma should be kept for sorting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions