Skip to content

[🐋 narwhals] create stub modules, classes, and functions for narwhals integration - #2081

Closed
cosmicBboy wants to merge 2 commits into
mainfrom
narwhals-dev
Closed

[🐋 narwhals] create stub modules, classes, and functions for narwhals integration#2081
cosmicBboy wants to merge 2 commits into
mainfrom
narwhals-dev

Conversation

@cosmicBboy

@cosmicBboy cosmicBboy commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

This PR adds stub modules, classes, and functions for the narwhals integration #1894.

Claude code summary:

Created Files and Structure:

  1. Entry Point Module (pandera/narwhals.py)
  • Main public API entry point for narwhals integration
  • Imports and exports all key components (Column, DataFrameSchema, DataFrameModel, etc.)
  • Registers narwhals backends
  1. API Components (pandera/api/narwhals/)
  • types.py: Core type definitions (NarwhalsData, CheckResult, type aliases)
  • components.py: Column schema validation component
  • container.py: DataFrameSchema for full DataFrame validation
  • model.py: DataFrameModel for class-based schema definition
  • utils.py: Utility functions for schema extraction and validation depth
  • model_config.py: Configuration for DataFrameModel
  1. Backend Implementation (pandera/backends/narwhals/)
  • base.py: Base backend functionality with NarwhalsSchemaBackend
  • register.py: Backend registration system
  • checks.py: Check backend for validation functions
  • components.py: Column validation backend
  • container.py: DataFrame validation backend
  • builtin_checks.py: Built-in validation checks (equal_to, greater_than, etc.)
  1. Engine Layer (pandera/engines/narwhals_engine.py)
  • Core narwhals engine and data types
  • Type conversion utilities
  • DataType classes for common types (Int64, Float64, String, etc.)
  1. Typing Support (pandera/typing/narwhals.py)
  • Generic type annotations for DataFrame[T], LazyFrame[T], Series[T]
  • Pydantic integration for schema validation
  • Format conversion utilities

Key Features:

  • Import Entry Point: import pandera.narwhals provides the full API
  • Modular Architecture: Follows the same patterns as polars integration
  • Type Safety: Strong typing with narwhals generics
  • Backend Registration: Automatic registration of validation backends
  • Extensible Checks: Built-in validation functions with decorator system
  • Pydantic Integration: Support for Pydantic v2 validation
  • Format Support: Placeholder infrastructure for various data formats

The implementation maintains the same API surface as the polars integration while adapting to
Narwhals' DataFrame-agnostic approach. All modules contain placeholder implementations that follow
the correct patterns and interfaces, ready for full implementation.

…arwhals integration

Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
@cosmicBboy cosmicBboy changed the title [🤖 claude-assisted] create stub modules, classes, and functions for narwhals integration [🤖 claude-code] create stub modules, classes, and functions for narwhals integration Jul 16, 2025
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
@cosmicBboy cosmicBboy changed the title [🤖 claude-code] create stub modules, classes, and functions for narwhals integration [🐋 narwhals] create stub modules, classes, and functions for narwhals integration Jul 17, 2025
@cosmicBboy cosmicBboy mentioned this pull request Jul 23, 2025
@cosmicBboy cosmicBboy mentioned this pull request Feb 12, 2026
3 tasks
@cosmicBboy

Copy link
Copy Markdown
Collaborator Author

closing this in favor of #2223

@cosmicBboy cosmicBboy closed this Mar 17, 2026
@cosmicBboy
cosmicBboy deleted the narwhals-dev branch March 20, 2026 00:34
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