refactor: improve type safety with generic parameters and package support#15
Merged
Kamilbenkirane merged 2 commits intomainfrom Nov 7, 2025
Merged
Conversation
…port This commit enhances type safety across the codebase and adds support for packages workspace: **Type Safety Improvements:** - Add `Params` type parameter to `Client` class for capability-specific parameter typing - Update `Stream` class with `Params` generic for type-safe parameter passing - Add proper type annotations to abstract methods (`_parse_content`, `_create_inputs`, etc.) - Fix mypy type errors with proper overrides and return type annotations - Disable specific mypy error codes for tests and package modules to reduce noise **Package Support:** - Extend CI/CD workflows to include `packages/` directory in linting, formatting, type checking, and security scans - Update Makefile commands to check packages alongside core source - Add mypy configuration for package modules with appropriate error code handling **Constraint Enhancement:** - Add `special_values` parameter to `Range` constraint to allow specific values that bypass min/max validation **Test Updates:** - Fix type annotations in test files to match updated abstract method signatures - Add proper type ignores where needed for test flexibility All changes maintain backward compatibility while improving type safety and developer experience.
The packages/ directory exists locally but may not be present in CI until committed. Add conditional checks to only include packages/ in checks if the directory exists.
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
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.
Summary
This PR enhances type safety across the codebase and adds comprehensive support for the packages workspace:
Paramsgeneric parameter toClientandStreamclasses for capability-specific parameter typingpackages/directory in all quality checksspecial_valuesparameter toRangeconstraint for flexible validationKey Changes
Type Safety Improvements
Paramstype parameter toClient[In, Out, Params]for strongly-typed parameters per capabilityStream[Out, Params]to pass parameters through to_parse_output()Package Support
.github/workflows/ci.ymlto includepackages/in format, lint, type-check, and security jobsMakefilecommands (lint, format, typecheck, security) to check packagesceleste_*package modulesConstraint Enhancement
Rangeconstraint now acceptsspecial_valueslist to allow specific values outside min/max boundsTest Plan
Impact