Skip to content
New issue

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

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

Already on GitHub? # to your account

Feat/provider pushbullet #27

Merged
merged 4 commits into from
Mar 2, 2025
Merged

Feat/provider pushbullet #27

merged 4 commits into from
Mar 2, 2025

Conversation

EvickaStudio
Copy link
Owner

@EvickaStudio EvickaStudio commented Mar 2, 2025

This pull request introduces support for Pushbullet notifications in the project. The changes include updates to configuration files, the addition of a new Pushbullet provider, and modifications to the initialization process to incorporate the new provider.

New Pushbullet Notification Support:

Summary by Sourcery

Adds support for sending notifications via Pushbullet. This includes a new provider implementation, configuration settings, and updates to the initialization process.

New Features:

  • Introduces a new Pushbullet notification provider to send notifications to devices.
  • Adds a configuration option to include AI summaries in Pushbullet notifications.

Eliminated the pushbullet.py dependency from requirements.txt to streamline the project and reduce unnecessary package management. This change helps maintain a cleaner environment and focuses on essential libraries.
Created a new module for the webhook site provider to support custom notification integrations. This addition allows for greater flexibility in notification delivery methods, enhancing the overall notification system.
Implemented Pushbullet notification provider to enable sending notifications across devices. This addition allows users to receive alerts formatted in Markdown, enhancing the notification experience. Configuration options include enabling the provider and including AI-generated summaries.

- Integrated Pushbullet provider into the notification system
- Added configuration options for API key and summary inclusion
- Updated README and example config for new provider details
@EvickaStudio EvickaStudio self-assigned this Mar 2, 2025
Copy link
Contributor

sourcery-ai bot commented Mar 2, 2025

Reviewer's Guide by Sourcery

This pull request introduces support for Pushbullet notifications. It includes the implementation of the Pushbullet provider, updates to the configuration schema and loading process, and modifications to the initialization process to incorporate the new provider. The changes also include updates to the documentation and example configuration file.

Sequence diagram for initializing Pushbullet provider

sequenceDiagram
    participant ConfigLoader
    participant Config
    participant PushbulletConfig
    participant NotificationProvider
    participant PushbulletProvider

    ConfigLoader->Config: _init_config()
    ConfigLoader->ConfigLoader: _load_pushbullet_config()
    ConfigLoader->PushbulletConfig: Create PushbulletConfig
    ConfigLoader->Config: pushbullet = PushbulletConfig
    ConfigLoader->NotificationProvider: initialize_providers(config)
    alt config.pushbullet.enabled
        NotificationProvider->PushbulletProvider: PushbulletProvider(api_key, include_summary)
        NotificationProvider->NotificationProvider: providers.append(PushbulletProvider)
    end
Loading

Updated class diagram for configuration schema

classDiagram
    class Config
    class WebhookSiteConfig {
        enabled: bool
        url: str
        include_summary: bool
    }
    class PushbulletConfig {
        enabled: bool
        api_key: str
        include_summary: bool
    }

    Config ..> WebhookSiteConfig : has
    Config ..> PushbulletConfig : has
    note for PushbulletConfig "New PushbulletConfig class added"
Loading

Class diagram for PushbulletProvider

classDiagram
    class PushbulletProvider {
        -api_key: str
        -include_summary: bool
        -base_url: str
        -session: Session
        +__init__(api_key: str, include_summary: bool)
        +send(subject: str, message: str, summary: Optional[str]) : bool
    }
    class NotificationProvider{
        <<Interface>>
        +send(subject: str, message: str, summary: Optional[str]) : bool
    }

    PushbulletProvider --|> NotificationProvider : implements
    note for PushbulletProvider "New PushbulletProvider class added"
Loading

File-Level Changes

Change Details Files
Introduced Pushbullet notification provider, including configuration schema, provider implementation, and initialization logic.
  • Added PushbulletConfig dataclass to define the configuration schema for Pushbullet.
  • Implemented the PushbulletProvider class for sending notifications via Pushbullet.
  • Updated the initialization process to include the Pushbullet provider if enabled.
  • Added methods to load Pushbullet configuration.
  • Added include_summary setting under the Pushbullet section in the example config.
src/core/config/schema.py
src/providers/notification/pushbullet/provider.py
src/providers/notification/__init__.py
src/core/config/loader.py
example_config.ini
Updated documentation and configuration examples to reflect the new Pushbullet provider.
  • Added Pushbullet to the list of supported platforms in the README.
  • Updated the example configuration section in the README.
README.md
example_config.ini

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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
Contributor

@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 @EvickaStudio - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a try-except block around the Pushbullet provider initialization to gracefully handle potential API key issues.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 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.

Comment on lines +57 to +59
# Send the request
request_manager.update_headers(headers)
response = self.session.post(f"{self.base_url}/pushes", json=payload)
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Use request-specific headers instead of mutating global session headers.

Passing the headers directly to the session.post call (e.g., using the 'headers' parameter) would prevent possible unintended side effects on the global session, which is especially important in concurrent environments.

Suggested change
# Send the request
request_manager.update_headers(headers)
response = self.session.post(f"{self.base_url}/pushes", json=payload)
# Send the request using request-specific headers
response = self.session.post(f"{self.base_url}/pushes", json=payload, headers=headers)

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@EvickaStudio EvickaStudio merged commit 4a7363e into dev Mar 2, 2025
7 checks passed
@EvickaStudio EvickaStudio deleted the feat/provider-pushbullet branch March 2, 2025 20:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant