fix: import crash on narwhals 1.x; bump to 0.3.5 - #13
Closed
jrosenfeld13 wants to merge 1 commit into
Closed
Conversation
narwhals 1.x exposes narwhals.typing aliases (IntoSeries) as plain strings at runtime, so `IntoSeries | None` in neutralization/penalization signatures raised TypeError at import time — and neutralization is eagerly imported, so `import centimators` itself crashed on any narwhals 1.x install (the declared floor is 1.39). Add `from __future__ import annotations` to both modules, an import-walk smoke test, and a CI job running it at the narwhals floor so the latest-narwhals lockfile can't mask floor breakage again. Verified: full suite green on locked narwhals 2.10.2; import test green on 1.39.0; four-transformer chain bit-exact vs pinned reference on 1.48.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1GweKDrBJLe7KcqhmZSPm
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Problem
import centimatorscrashes withTypeError: unsupported operand type(s) for |: 'str' and 'NoneType'on any narwhals 1.x install (the declared floor is>=1.39.0). narwhals 1.x exposesnarwhals.typingaliases likeIntoSeriesas plain strings at runtime, soera_series: IntoSeries | None = Noneinneutralization.py(eagerly imported at top level) andpenalization.pyexplodes at import time.CI never caught it because the lockfile tracks latest narwhals (2.10.2), where the aliases are real types.
Fix
from __future__ import annotationsinneutralization.pyandpenalization.py(annotations become lazy strings on every Python/narwhals version).tests/test_imports.py: pkgutil walk importing every module — ImportError (optional deps) tolerated, anything else fails.--with "narwhals==1.39.0"so the floor is actually exercised.Verified
🤖 Generated with Claude Code
https://claude.ai/code/session_01B1GweKDrBJLe7KcqhmZSPm