Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pep 753 #9969

Merged
merged 3 commits into from
Jan 11, 2025
Merged

Pep 753 #9969

merged 3 commits into from
Jan 11, 2025

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Jan 6, 2025

companion to python-poetry/poetry-core#807

Summary by Sourcery

Chores:

  • Standardize metadata fields to adhere to PEP 753.

Copy link

sourcery-ai bot commented Jan 6, 2025

Reviewer's Guide by Sourcery

This PR refactors the create_pyproject_from_package method to use individual if statements for each optional metadata field instead of a loop. It also updates the test_builder_installs_proper_files_for_standard_packages and test_builder_generates_proper_metadata_when_multiple_readme_files tests to reflect the metadata changes.

Sequence diagram for create_pyproject_from_package metadata handling

sequenceDiagram
    participant Package
    participant Factory
    participant TOMLDocument

    Factory->>Package: Get documentation_url
    alt has documentation_url
        Package-->>Factory: Return documentation_url
        Factory->>TOMLDocument: Set documentation field
    end

    Factory->>Package: Get repository_url
    alt has repository_url
        Package-->>Factory: Return repository_url
        Factory->>TOMLDocument: Set repository field
    end

    Factory->>Package: Get homepage
    alt has homepage
        Package-->>Factory: Return homepage
        Factory->>TOMLDocument: Set homepage field
    end

    Factory->>Package: Get maintainers
    alt has maintainers
        Package-->>Factory: Return maintainers
        Factory->>TOMLDocument: Set maintainers field
    end

    Factory->>Package: Get keywords
    alt has keywords
        Package-->>Factory: Return keywords
        Factory->>TOMLDocument: Set keywords field
    end
Loading

Class diagram for Package and Factory relationship

classDiagram
    class Package {
        +documentation_url: str
        +repository_url: str
        +homepage: str
        +maintainers: list
        +keywords: list
        +classifiers: list
    }

    class Factory {
        +create_pyproject_from_package(package: Package) TOMLDocument
    }

    Factory ..> Package : uses
    note for Factory "Refactored to use individual
if statements for metadata fields"
Loading

File-Level Changes

Change Details Files
Refactored optional metadata handling in create_pyproject_from_package
  • Replaced the loop for setting optional metadata fields with individual if statements for each field: documentation, repository, homepage, maintainers, and keywords.
src/poetry/factory.py
Updated tests to reflect metadata changes
  • Removed Home-page metadata field and added Project-URL: Homepage in test_builder_installs_proper_files_for_standard_packages and test_builder_generates_proper_metadata_when_multiple_readme_files tests.
tests/masonry/builders/test_editable_builder.py

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @dimbleby - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please expand the PR description to provide more context about which aspects of PEP 753 are being implemented and why these changes are necessary.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@abn abn enabled auto-merge (squash) January 11, 2025 15:16
@abn abn merged commit 32ec5cb into python-poetry:main Jan 11, 2025
73 checks passed
@dimbleby dimbleby deleted the pep-753 branch January 11, 2025 21:45
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.

2 participants