Skip to content

chore(typing): add CompliantExpr._version#2060

Merged
MarcoGorelli merged 1 commit intomainfrom
compliant-expr-version
Feb 21, 2025
Merged

chore(typing): add CompliantExpr._version#2060
MarcoGorelli merged 1 commit intomainfrom
compliant-expr-version

Conversation

@dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Feb 21, 2025

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

All implementors of the protocol already define this, meaning CompliantExpr can now match _FullContext

narwhals/narwhals/utils.py

Lines 77 to 100 in 4dda548

class _StoresImplementation(Protocol):
_implementation: Implementation
"""Implementation of native object (pandas, Polars, PyArrow, ...)."""
class _StoresBackendVersion(Protocol):
_backend_version: tuple[int, ...]
"""Version tuple for a native package."""
class _StoresVersion(Protocol):
_version: Version
"""Narwhals API version (V1 or MAIN)."""
class _LimitedContext(_StoresBackendVersion, _StoresVersion, Protocol):
"""Provides 2 attributes.
- `_backend_version`
- `_version`
"""
class _FullContext(_StoresImplementation, _LimitedContext, Protocol): # noqa: PYI046
"""Provides 3 attributes.
- `_implementation`
- `_backend_version`

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @dangotbanned !

@MarcoGorelli MarcoGorelli merged commit 44324b9 into main Feb 21, 2025
29 checks passed
@MarcoGorelli MarcoGorelli deleted the compliant-expr-version branch February 21, 2025 16:44
dangotbanned added a commit that referenced this pull request Feb 21, 2025
dangotbanned added a commit that referenced this pull request Feb 22, 2025
Will simplify a workaround I've done in #2064 (comment)
Related: #2060
MarcoGorelli pushed a commit that referenced this pull request Feb 22, 2025
Will simplify a workaround I've done in #2064 (comment)
Related: #2060
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants