Skip to content

feat: P0+P1 improvements — bug fix, types, functional methods, async support#2

Open
mr-wuliu wants to merge 6 commits into
mainfrom
feat/p0-p1-improvements
Open

feat: P0+P1 improvements — bug fix, types, functional methods, async support#2
mr-wuliu wants to merge 6 commits into
mainfrom
feat/p0-p1-improvements

Conversation

@mr-wuliu
Copy link
Copy Markdown
Owner

Summary

  • P0 Bug fix: pipeline.py returned value instead of attr for non-callable value attributes (inconsistent with ChainableResult)
  • P0 Type annotations: Added Generic[T] to CommonChain, ChainableResult, PipelineResult; full type hints across all modules with from __future__ import annotations
  • P0 Test coverage: Expanded from 50% → 83% with direct tests for CommonChain dunders (arithmetic, comparison, unary, conversion), edge cases
  • P1 Functional composition: Added .map(), .filter(), .flat_map(), .inspect(), .tap() to CommonChain — accessible through both @chainable and @pipeline chains
  • P1 Async support: New @async_chainable and @async_pipeline decorators with AsyncChainableResult / AsyncPipelineResult — coroutine chaining with __await__ for final resolution
  • PEP 561: Added py.typed marker, updated __init__.py exports

Test plan

  • 34/34 tests passing (was 8)
  • 83% coverage (was ~50%)
  • All existing tests remain green
  • New tests cover: CommonChain dunders, functional methods, async chainable, async pipeline

mrwuliu and others added 6 commits April 28, 2026 04:06
…ods, async support

P0 fixes:
- Fix pipeline.py bug: return value → return attr for non-callable value attrs
- Add Generic[T] type annotations across all modules
- Add from __future__ import annotations for forward references
- Expand test coverage to 83% with direct tests for CommonChain dunders

P1 features:
- Add functional composition: .map(), .filter(), .flat_map(), .inspect(), .tap()
- Add async support: @async_chainable, @async_pipeline with __await__
- Add py.typed marker for PEP 561 compliance
- Update __init__.py to export all 4 decorators

34 tests passing, 83% coverage.
- Add [tool.basedpyright] config (strict mode) with justified suppressions
  for proxy-pattern-inherent Any, override, and unknown lambda warnings
- Fix map() return type error with targeted pyright ignore comment
- Create tests/test_types.py with TYPE_CHECKING guards for public API
  type inference verification (chainable, pipeline, async, functional)
- Add basedpyright type-check step to CI workflow

basedpyright: 0 errors, 0 warnings, 0 notes
pytest: 34/34 passed
@chainable and @pipeline now auto-detect coroutines via inspect.iscoroutine()
and return AsyncChainableResult/AsyncPipelineResult accordingly.

- Add @overload signatures for proper type narrowing (sync vs async)
- Remove async_chainable/async_pipeline from __all__
- Update tests to use @chainable/@pipeline on async methods
- async_chainable.py/async_pipeline.py kept for internal result classes

__all__ = ['chainable', 'pipeline']
basedpyright: 0 diagnostics, pytest: 34/34 passed
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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.

1 participant