Skip to content

BUG: Fix license-expression metadata breaking twine check - #2632

Merged
blowekamp merged 1 commit into
SimpleITK:mainfrom
blowekamp:fix_pyproject_license
Jul 15, 2026
Merged

blowekamp merged 1 commit into
SimpleITK:mainfrom
blowekamp:fix_pyproject_license

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Summary

Fix InvalidDistribution: unrecognized or malformed field 'license-expression' error from twine check breaking the nightly packaging GHA workflow.

Problem

The bare SPDX string form license = "Apache-2.0" is PEP 639 syntax, which causes scikit-build-core to emit a License-Expression: field in core metadata 2.4. Older versions of twine do not recognize license-expression as a valid metadata field and reject the distribution.

Fix

Changed license = "Apache-2.0" to license = {text = "Apache-2.0"} in both:

  • pyproject.toml
  • Wrapping/Python/Packaging/pyproject.toml.in

The table form emits the traditional License: field (core metadata 2.1), which is compatible with all twine versions.

Use the table form  instead of the
bare SPDX string . The bare string is PEP 639
syntax that emits a  field in core metadata 2.4,
which older twine versions do not recognize and flag as an invalid
distribution, breaking the nightly packaging GHA workflow.
@blowekamp
blowekamp requested review from Copilot and zivy and removed request for Copilot July 15, 2026 12:57
@blowekamp
blowekamp marked this pull request as ready for review July 15, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Python package metadata to avoid generating the Core Metadata License-Expression field (triggered by PEP 639-style license = "Apache-2.0"), which breaks twine check on older Twine versions used by the nightly packaging workflow.

Changes:

  • Switch license from a bare SPDX string to the table form license = {text = "Apache-2.0"} in the root pyproject.toml.
  • Apply the same license metadata change to the packaging template Wrapping/Python/Packaging/pyproject.toml.in.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pyproject.toml Uses table-form license to avoid emitting License-Expression metadata that older Twine rejects.
Wrapping/Python/Packaging/pyproject.toml.in Mirrors the same license metadata change in the packaging template to keep generated packaging consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blowekamp
blowekamp merged commit 2d57a39 into SimpleITK:main Jul 15, 2026
10 checks passed
@blowekamp
blowekamp deleted the fix_pyproject_license branch September 9, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants