refactor(types): remove redundant total=False from TypedDict definitions #127
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
Removes the redundant
total=Falseparameter from all TypedDict class definitions throughout the codebase. Whentotal=Falseis used withNotRequired[...]wrappers on all fields, it creates unnecessary redundancy and confusion.Problem
The anti-pattern was pervasive across the entire codebase:
When
total=Falseis specified, all fields are implicitly optional, making theNotRequired[...]wrapper redundant. This pattern was:NotRequiredSolution
Use the correct TypedDict pattern where
total=True(the default) with explicitNotRequired[...]for optional fields:Changes Made
Python Files (15 files, 30+ TypedDict classes)
sqlspec/config.py- LifecycleConfig, MigrationConfig, LitestarConfigsqlspec/adapters/adbc/config.py- AdbcConnectionParams, AdbcDriverFeaturessqlspec/adapters/aiosqlite/config.py- AiosqliteConnectionParams, AiosqlitePoolParams, AiosqliteDriverFeaturessqlspec/adapters/asyncmy/config.py- AsyncmyConnectionParams, AsyncmyPoolParams, AsyncmyDriverFeaturessqlspec/adapters/asyncpg/config.py- AsyncpgConnectionConfig, AsyncpgPoolConfig, AsyncpgDriverFeaturessqlspec/adapters/bigquery/config.py- BigQueryConnectionParams, BigQueryDriverFeaturessqlspec/adapters/duckdb/config.py- DuckDBConnectionParams, DuckDBExtensionConfig, DuckDBSecretConfig, DuckDBDriverFeaturessqlspec/adapters/oracledb/config.py- OracleConnectionParams, OraclePoolParams, OracleDriverFeaturessqlspec/adapters/psqlpy/config.py- PsqlpyConnectionParams, PsqlpyPoolParams, PsqlpyDriverFeaturessqlspec/adapters/psycopg/config.py- PsycopgConnectionParams, PsycopgPoolParams, PsycopgDriverFeaturessqlspec/adapters/sqlite/config.py- SqliteConnectionParams, SqliteDriverFeaturessqlspec/adapters/sqlite/pool.py- SqliteConnectionParamssqlspec/extensions/adk/config.py- ADKConfigsqlspec/extensions/litestar/config.py- LitestarConfigDocumentation (1 file, 8 examples)
AGENTS.md- Updated all TypedDict examples in driver_features pattern documentationBenefits
✅ Clarity: Fields are explicitly marked as optional with
NotRequired✅ Consistency: One canonical way to define optional fields
✅ Best Practices: Aligns with Python typing standards
✅ IDE Support: Better type checking and autocomplete
✅ Maintainability: Less confusion for contributors
Testing
make fix- All linting passespyright- 0 errors, 0 warningsNotRequired[...]wrappers preserved exactlyImpact
No breaking changes - This is purely a refactor of type definitions. The runtime behavior and type checking behavior remain identical.
References