Skip to content

Support SPDX WITH expressions - #809

Merged
takluyver merged 3 commits into
pypa:mainfrom
yangfan-yf-yf:fix/spdx-with-exceptions
Sep 14, 2026
Merged

takluyver merged 3 commits into
pypa:mainfrom
yangfan-yf-yf:fix/spdx-with-exceptions

Conversation

@yangfan-yf-yf

@yangfan-yf-yf yangfan-yf-yf commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Closes #735.

This adds SPDX exception IDs for WITH expressions. The parser now normalises exception IDs, retains the existing uppercase-operator rule, and rejects a second WITH after an exception ID.

The generated license data remains aligned with SPDX v3.26, which matches the version already used for the existing license IDs; this change adds only exception IDs.

Validation:

  • python -m pytest flit_core/tests_core -q with PYTHONPATH=flit_core (216 passed, 1 skipped)
  • Boundary checks for case normalisation and repeated WITH

@yangfan-yf-yf
yangfan-yf-yf marked this pull request as ready for review July 23, 2026 15:02

@takluyver takluyver left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this looks good to me.

Could you add an entry in the documentation about version constraints, that license expressions using WITH require flit_core >=4.1?

Comment thread flit_core/flit_core/config.py Outdated
else:
if parts and parts[-1] not in {' AND ', ' OR ', '('}:
if parts and parts[-1] not in {' AND ', ' OR ', ' WITH ', '('}:
reason = "a license ID must follow either AND, OR, or '('"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The message here should be updated now that WITH and exception IDs are also accepted

@yangfan-yf-yf

Copy link
Copy Markdown
Contributor Author

Updated in 33a7a39:

  • Added the flit_core >=4.1 requirement for license expressions using WITH to the version constraints documentation.
  • Updated the parser error message to mention exception IDs and WITH.

Validation: core tests passed (217 passed, 1 skipped), the valid-expression and updated-error-message checks passed, and the Sphinx HTML build passed with warnings treated as errors.

@takluyver takluyver added this to the 4.1 milestone Sep 13, 2026
@takluyver
takluyver merged commit 3c92604 into pypa:main Sep 14, 2026
18 checks passed
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.

Support WITH in SPDX license expressions

2 participants