poetry icon indicating copy to clipboard operation
poetry copied to clipboard

add support for PEP 639 License Clarity

Open radoering opened this issue 9 months ago • 2 comments

Pull Request Check List

Requires: python-poetry/poetry-core#870 Resolves: #9670

  • [x] Added tests for changed code (see poetry-core PR).
  • [x] Updated documentation for changed code.

Summary by Sourcery

Add support for PEP 639 license clarity by simplifying license specification, introducing a license-files field with default glob patterns, and updating documentation, tests, and dependency references accordingly.

New Features:

  • Introduce license-files field in pyproject.toml for specifying license file patterns with configurable defaults

Enhancements:

  • Deprecate table-based license specification in favor of simple string identifiers
  • Define default license file globs included in distributions and allow overriding by an empty list

Documentation:

  • Update pyproject.md and libraries.md to document the license-files field and deprecation of table syntax
  • Clarify default license-related files included in wheel and sdist builds

Tests:

  • Add warning for deprecated or invalid SPDX license identifiers in the check command
  • Update test fixtures to use string-based license fields instead of tables

radoering avatar May 31 '25 05:05 radoering

Reviewer's Guide

Add PEP 639 License Clarity support by simplifying license specification, introducing a license-files field with default glob patterns, deprecating table-based license syntax, and updating documentation, tests, and dependency references accordingly.

Class diagram for license specification changes in pyproject.toml

classDiagram
    class ProjectMetadata {
        +license: str
        +license_files: List[str]
    }
    ProjectMetadata : -license (table syntax) [deprecated]
    ProjectMetadata : +license (SPDX string)
    ProjectMetadata : +license_files (glob patterns)
    ProjectMetadata : +license_files = default patterns if not specified
    ProjectMetadata : +license_files = [] disables inclusion

Class diagram for updated build process including license files

classDiagram
    class Builder {
        +build_sdist()
        +build_wheel()
        +include_license_files(patterns: List[str])
    }
    Builder --> ProjectMetadata
    Builder : +include_license_files uses license_files from ProjectMetadata
    Builder : +include_license_files uses default patterns if not specified
    Builder : +include_license_files skips if patterns is empty

File-Level Changes

Change Details Files
Simplify license specification and introduce license-files field
  • Deprecate table-based license syntax in favor of simple string identifiers
  • Add license-files section with default patterns and override behavior
  • Update root project manifest to use string-based license field
docs/pyproject.md
docs/libraries.md
pyproject.toml
Update builder metadata and test assertions for license expressions
  • Replace License: header with License-Expression: in editable builder tests
  • Remove old license classifier expectation from METADATA
  • Standardize file content assertions in test_editable_builder
tests/masonry/builders/test_editable_builder.py
Add SPDX validation warnings and update related tests and fixtures
  • Introduce warning for deprecated/invalid SPDX identifiers in check command tests
  • Update invalid_pyproject fixture to use string-based license
  • Update simple_project fixture to use string-based license
tests/console/commands/test_check.py
tests/fixtures/invalid_pyproject/pyproject.toml
tests/fixtures/simple_project/pyproject.toml
Require updated packaging version for PEP 639 support
  • Bump packaging dependency to >=24.2 in project manifest
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar May 31 '25 05:05 sourcery-ai[bot]

Deploy preview for website ready!

✅ Preview https://website-2pqoe34nt-python-poetry.vercel.app

Built with commit 94098f6d6de33cdf73be572ac3453e6ee546edb3. This pull request is being automatically deployed with vercel-action

github-actions[bot] avatar May 31 '25 05:05 github-actions[bot]

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 17 '25 00:09 github-actions[bot]