feat(source/show): notify when PyPI is implicit
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.
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
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"
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Added notification for implicit PyPI source. |
|
src/poetry/console/commands/source/show.py |
| Added test for implicit PyPI notification. |
|
tests/console/commands/source/test_show.py |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon 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-aianywhere in the pull request title to generate a title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere 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
- 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.
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.