Skip to content

feat: re-export BrokerUsecase from top-level package#2864

Open
SarthakB11 wants to merge 1 commit into
ag2ai:mainfrom
SarthakB11:fix/issue-2806
Open

feat: re-export BrokerUsecase from top-level package#2864
SarthakB11 wants to merge 1 commit into
ag2ai:mainfrom
SarthakB11:fix/issue-2806

Conversation

@SarthakB11
Copy link
Copy Markdown

Description

Re-export BrokerUsecase from the top-level faststream package so users who want to subclass it for a custom broker can rely on a stable import path. Previously it was only reachable via faststream._internal.broker.broker, which has no stability guarantees across non-breaking releases.

from faststream import BrokerUsecase

Minimal subset of #2806. Other subclassing types (MsgType, ConnectionType, BrokerConfigType, Registrator) and a custom-broker docs page are left as separate follow-ups.

Fixes #2806

Type of change

  • New feature (a non-breaking change that adds functionality)

Checklist

  • My code adheres to the style guidelines of this project (just lint shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation — N/A, no public-API surface change beyond the re-export itself
  • My changes do not generate any new warnings (mypy faststream clean across 496 files; bandit -ll no medium/high)
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature — N/A, pure re-export with no behavior change. Smoke-checked locally: python -c "from faststream import BrokerUsecase; import faststream; assert 'BrokerUsecase' in faststream.__all__".
  • Both new and existing unit tests pass successfully on my local environment — ran the typing-dependent suite locally (pytest tests/docs/getting_started/subscription/test_annotated.py → 10 passed). Skipped full just test-coverage (heavy) and broker-integration tests (require Kafka/Rabbit/Redis/NATS infra).
  • I have ensured that static analysis tests are passing — ruff format --check, ruff check, and mypy faststream (496 files) all clean.
  • I have included code examples to illustrate the modifications

@SarthakB11 SarthakB11 requested a review from Lancetnik as a code owner May 9, 2026 18:51
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.

Feature: Expose BrokerUsecase

1 participant