-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Feat: Add Pythonic Pipeline pattern using functional composition #461
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
michaelj094
wants to merge
1
commit into
faif:master
from
michaelj094:feat/add-functional-pipeline-pattern
Open
Feat: Add Pythonic Pipeline pattern using functional composition #461
michaelj094
wants to merge
1
commit into
faif:master
from
michaelj094:feat/add-functional-pipeline-pattern
+118
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
michaelj094
commented
Jan 9, 2026
Hi @faif
Thanks for maintaining this repository.
I’ve added a Pythonic example of the Pipeline (functional pipeline) pattern, focusing on
callable-based composition and generator-style stages, in line with the educational
and minimal style of the repo.
I’d appreciate your review when you have time. Any feedback or suggestions are very welcome.
Thanks!
Owner
faif
commented
Jan 15, 2026
Hi,
Thanks for the contribution. Can you fix the linter errors?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Summary
This PR adds a Pythonic implementation of the Pipeline (Functional Pipeline) pattern to the repository.
The example demonstrates how sequential data processing can be composed using callables, iterables, and generators, instead of class-heavy or framework-style abstractions. The goal is to provide a clear, minimal reference that aligns with common Python idioms.
Motivation
While the repository includes many classic GoF and architectural patterns, it did not previously contain a dedicated example of the Pipeline pattern, which is widely used in Python for:
Adding this pattern fills a practical gap and reflects how Python developers commonly structure such flows.
Files Changed
Added
patterns/behavioral/pipeline.pyAdds a Pythonic implementation of the Pipeline (Functional Pipeline) pattern,
including a short TL;DR, minimal implementation, and runnable example.
tests/test_pipeline.pyAdds a small test to verify pipeline composition and behavior.
Changed
README.mdAdds
pipelineto the list of behavioral patterns.Design & Implementation
The implementation focuses on simplicity and readability:
Iterableinto anotherIterablecomposehelper connects stages left-to-rightPipelinewrapper is included for convenience without introducing complex abstractionsExample
The included demonstration builds a pipeline that:
This illustrates how small, reusable stages can be combined into a readable data flow.
Testing
The behavior was verified by running the example included in the module.
Doc
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=191372963