Skip to content

Event consumer API simplification into develop #2566

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

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

jrobinAV
Copy link
Member

What type of PR is this? (Check all that apply)

  • 🛠 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • ⚡ Optimization
  • 📝 Documentation Update

Description

Open a new API using an EventConsumer Service

Related Tickets & Documents

Checklist

We encourage keeping the code coverage percentage at 80% or above.

  • ✅ This solution meets the acceptance criteria of the related issue.
  • 📝 The related issue checklist is completed.
  • 🧪 This PR includes unit tests for the developed code.
  • 📚 The documentation has been updated, or a dedicated issue has been created.
    If not, explain why:
  • 📌 The release notes have been updated.
    If not, explain why:

@jrobinAV jrobinAV requested review from trgiangdo and Copilot April 15, 2025 15:05
@jrobinAV jrobinAV changed the title Feature/#2306 event consumer simplification Event consumer API simplification into develop Apr 15, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

@jrobinAV jrobinAV self-assigned this Apr 15, 2025
trgiangdo
trgiangdo previously approved these changes Apr 16, 2025
Copy link
Member

@trgiangdo trgiangdo left a comment

Choose a reason for hiding this comment

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

Minor comments.

Other from the failing linter test, the PR looks good to me

@jrobinAV jrobinAV requested review from trgiangdo and Copilot April 17, 2025 20:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new API for handling events via the EventConsumer service along with an extensive suite of tests that cover various event types (scenario, datanode written/deleted/created, and generic events). Key changes include:

  • Adding new unit tests to validate filtering and callback delegation for events.
  • Refactoring internal core event consumer naming from CoreEventConsumerBase to _CoreEventConsumerBase.
  • Updating tests and auxiliary modules to align with the new API and naming conventions.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/event/test_consumer__on_scenario_created.py Tests for the scenario created event handling with multiple configuration setups.
tests/event/test_consumer__on_event.py Tests for event subscription, duplicate topics, and callback argument handling.
tests/event/test_consumer__on_datanode_written.py Tests for datanode written events validating config matches and broadcast behavior.
tests/event/test_consumer__on_datanode_deleted.py Tests for datanode deletion events with both matching and non-matching configurations.
tests/event/test_consumer__on_datanode_created.py Tests for datanode created events including scenarios with callback arguments and broadcast.
tests/event/conftest.py Updates to fixtures supporting the new event consumer API tests.
tests/core/notification/*.py Refactoring tests to reflect internal naming changes and validate event registration.
taipy/gui_core/_context.py Updated to use the refactored _CoreEventConsumerBase for consistency.
taipy/core/data/json.py Minor updates to type-ignore comments for JSON encoder/decoder access.
taipy/core/common/_check_dependencies.py Added enterprise edition event package reference.
taipy/core/notification/_core_event_consumer.py Renamed the core consumer class to _CoreEventConsumerBase and adjusted related imports.
taipy/core/scenario/_scenario_manager.py Added an explicit type ignore comment for tags extraction to satisfy type checking.
Comments suppressed due to low confidence (1)

taipy/core/scenario/_scenario_manager.py:380

  • Consider explicitly casting 'tags' to the expected type (e.g. set or other collection) rather than using a type ignore comment. This may improve code clarity and maintainability.
tags = scenario.properties.get(cls._AUTHORIZED_TAGS_KEY, set())  # type: ignore[var-annotated]

Copy link
Member

@trgiangdo trgiangdo left a comment

Choose a reason for hiding this comment

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

LGTM

@jrobinAV
Copy link
Member Author

jrobinAV commented Apr 25, 2025

Waiting for discussion to be closed in issue #2306 before merging it into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigation - Simplify Core Event to make it accessible
2 participants