Skip to content

setuptools fails with "Invalid dash-separated key" or "Invalid uppercase key" #12440

@zanieb

Description

@zanieb

setuptools v78 no longer accepts options containing uppercase or dash characters in setup.cfg. This means if your package uses this feature, or if any of your dependencies need to be built from source (and are using the invalid syntax) then an error will be raised.

This can be worked around in the uv CLI by excluding new versions:

$ uv sync --exclude-newer 2025-03-24

This fix can be persisted in the pyproject.toml as:

[tool.uv]
exclude-newer = "2025-03-24T00:00:00Z"

Note this will prevent upgrading other packages.

If you are using uv pip, you can set a build constraint instead:

echo "setuptools<78" | uv pip install -b - <package>

This fix can be persisted in the pyproject.toml as:

[tool.uv]
build-constraint-dependencies = ["setuptools<78"]

There is an unrelated uv bug that does not propagate build-constraint-dependencies in uv sync (#12441). We will be releasing a fix for that soon.

I've asked for the change to be reverted upstream at pypa/setuptools#4870 (comment)

We're also adding a dedicated warning for this error case in #12438

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalThe problem is with another package or dependency (not uv)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions