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

feat(source/show): notify when PyPI is implicit #9974

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abn
Copy link
Member

@abn abn commented Jan 7, 2025

Add a notice when all sources are listed and PyPI is implicitly enabled.

Summary by Sourcery

Add a notification to inform users when PyPI is implicitly enabled as a primary source and update tests to verify this behavior.

New Features:

  • Add a notification feature to inform users when PyPI is implicitly enabled as a primary source.

Tests:

  • Introduce a test to verify the notification for implicit PyPI when no sources are configured.

@abn abn requested a review from a team January 7, 2025 00:42
Copy link

sourcery-ai bot commented Jan 7, 2025

Reviewer's Guide by Sourcery

This pull request introduces a notification feature to inform users when PyPI is implicitly enabled as a primary source in the 'source show' command. It adds a new method to handle this notification and updates the command logic to trigger it appropriately. Additionally, a test case is added to ensure the notification works as expected.

Sequence diagram for source show command with implicit PyPI notification

sequenceDiagram
    actor User
    participant CLI as Poetry CLI
    participant ShowCmd as SourceShowCommand
    participant Pool as Poetry Pool

    User->>CLI: poetry source show
    CLI->>ShowCmd: handle()
    ShowCmd->>ShowCmd: get_sources()
    alt no sources configured
        ShowCmd->>ShowCmd: notify_implicit_pypi()
        ShowCmd->>Pool: has_repository('pypi')
        Pool-->>ShowCmd: true/false
        ShowCmd-->>User: Display implicit PyPI notice
    else sources exist
        loop for each source
            ShowCmd->>ShowCmd: Display source info
        end
        alt PyPI not explicitly configured
            ShowCmd->>ShowCmd: notify_implicit_pypi()
            ShowCmd->>Pool: has_repository('pypi')
            Pool-->>ShowCmd: true/false
            ShowCmd-->>User: Display implicit PyPI notice
        end
    end
Loading

Class diagram for updated SourceShowCommand

classDiagram
    class SourceShowCommand {
        +handle(): int
        +notify_implicit_pypi(): None
    }
    note for SourceShowCommand "Added notify_implicit_pypi() method
to handle PyPI implicit source notification"
Loading

File-Level Changes

Change Details Files
Added notification for implicit PyPI source.
  • Introduced a new method notify_implicit_pypi to handle the notification.
  • Called notify_implicit_pypi in handle method when no sources are configured.
  • Checked if PyPI is implicitly enabled and called notify_implicit_pypi accordingly.
src/poetry/console/commands/source/show.py
Added test for implicit PyPI notification.
  • Imported PyPiRepository for testing purposes.
  • Added test case test_source_show_no_sources_implicit_pypi to verify the notification when PyPI is implicit.
tests/console/commands/source/test_show.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

Add a notice when all sources are listed and PyPI is implicitly enabled.
@abn abn force-pushed the command/sources/show-implicit-pypi-notice branch from 86c1938 to 21525c5 Compare January 7, 2025 00:43
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.

1 participant