Skip to content

pynumaflow-lite: Pythonic APIs for mapstreamer - #383

Merged
BulkBeing merged 2 commits into
mainfrom
lite-mapstreamer
Sep 27, 2026
Merged

BulkBeing merged 2 commits into
mainfrom
lite-mapstreamer

Conversation

@BulkBeing

@BulkBeing BulkBeing commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Similar to #382

Changed handler signature from handler(self, keys: list[str], datum: Datum) to handler(self, datum: Datum) as the keys are available in datum.keys. This is consistent with all map variants now.

Usage will look like:

class SimpleStreamCat(MapStreamer):
    async def handler(self, datum: Datum) -> AsyncIterator[Message]:
        if not datum.value:
            yield Message.to_drop()
            return
        for s in datum.value.decode("utf-8").split(","):
            yield Message(s.encode(), keys=datum.keys)


async def main() -> None:
    print("Starting MapStream server")
    # `serve` returns when SIGINT or SIGTERM arrives.
    await MapStreamAsyncServer(SimpleStreamCat()).serve()
    print("MapStream server stopped")


if __name__ == "__main__":
    asyncio.run(main())

Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.99%. Comparing base (3403754) to head (c3d9a28).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #383   +/-   ##
=======================================
  Coverage   92.99%   92.99%           
=======================================
  Files          68       68           
  Lines        3656     3656           
  Branches      236      236           
=======================================
  Hits         3400     3400           
  Misses        190      190           
  Partials       66       66           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
@BulkBeing
BulkBeing marked this pull request as ready for review September 27, 2026 01:29
@BulkBeing
BulkBeing merged commit 20b7f71 into main Sep 27, 2026
25 checks passed
@BulkBeing
BulkBeing deleted the lite-mapstreamer branch September 27, 2026 01:54
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.

2 participants