Skip to content

refactor(pynumaflow-lite): Pythonic APIs for BatchMapper - #382

Merged
vigith merged 5 commits into
mainfrom
batchmapper-improvements
Sep 26, 2026
Merged

vigith merged 5 commits into
mainfrom
batchmapper-improvements

Conversation

@BulkBeing

@BulkBeing BulkBeing commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Similar to: #374

See: packages/pynumaflow-lite/manifests/batchmap/batchmap_cat.py
From a user's perspective, the code will look like:

class SimpleBatchCat(BatchMapper):
    async def handler(self, batch: AsyncIterable[Datum]) -> list[BatchResponse]:
        responses = []
        async for datum in batch:
            if datum.value == b"bad world":
                responses.append(BatchResponse(datum.id, Message.to_drop()))
            else:
                responses.append(BatchResponse(datum.id, Message(datum.value, keys=datum.keys)))
        return responses


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


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

Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
@BulkBeing BulkBeing changed the title Batchmapper improvements feat(pynumaflow-lite): Pythonic APIs for BatchMapper Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.99%. Comparing base (5e64760) to head (88dc279).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #382   +/-   ##
=======================================
  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>
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
@BulkBeing BulkBeing changed the title feat(pynumaflow-lite): Pythonic APIs for BatchMapper pynumaflow-lite: Pythonic APIs for BatchMapper Sep 26, 2026
@BulkBeing
BulkBeing marked this pull request as ready for review September 26, 2026 04:07
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
]

__doc__ = pynumaflow_lite.__doc__
if hasattr(pynumaflow_lite, "__all__"):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all names are already added in as a static list above

@vigith vigith changed the title pynumaflow-lite: Pythonic APIs for BatchMapper refactor(pynumaflow-lite): Pythonic APIs for BatchMapper Sep 26, 2026
@vigith
vigith merged commit 3403754 into main Sep 26, 2026
25 checks passed
@vigith
vigith deleted the batchmapper-improvements branch September 26, 2026 15:10
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