Skip to content

fix: Add missing v2 constructor overrides #3006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 20, 2025

Conversation

dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Aug 18, 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

@dangotbanned dangotbanned added fix typing tests high priority Your PR will be reviewed very quickly if you address this and removed high priority Your PR will be reviewed very quickly if you address this labels Aug 18, 2025
Comment on lines 92 to +93
class DataFrame(NwDataFrame[IntoDataFrameT]):
_version = Version.V2
Copy link
Member Author

Choose a reason for hiding this comment

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

Very important bit that I missed before 😞

It might make more sense to use what I did for Namespace, where this is enforced at subclass-defintion-time

class Namespace(Generic[CompliantNamespaceT_co]):
_compliant_namespace: CompliantNamespaceT_co
_version: ClassVar[Version] = Version.MAIN
def __init__(self, namespace: CompliantNamespaceT_co, /) -> None:
self._compliant_namespace = namespace
def __init_subclass__(cls, *args: Any, version: Version, **kwds: Any) -> None:
super().__init_subclass__(*args, **kwds)
if isinstance(version, Version):
cls._version = version
else:
msg = f"Expected {Version} but got {type(version).__name__!r}"
raise TypeError(msg)

@dangotbanned dangotbanned marked this pull request as ready for review August 18, 2025 09:42
@dangotbanned dangotbanned added the bug: incorrect result Something isn't working label Aug 18, 2025
@dangotbanned
Copy link
Member Author

I marked as bug: incorrect result because v2.{DataFrame,Series}.from_*(...) didn't preserve the Version but v1 did.

I expect that could have some confusing consequences, so hopefully this can make the next release 🤞

@dangotbanned dangotbanned mentioned this pull request Aug 18, 2025
6 tasks
@dangotbanned dangotbanned marked this pull request as draft August 19, 2025 10:26
@dangotbanned dangotbanned marked this pull request as ready for review August 19, 2025 10:30
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.

@dangotbanned dangotbanned merged commit 256408d into main Aug 20, 2025
30 of 31 checks passed
@dangotbanned dangotbanned deleted the fix-missing-v2-constructors branch August 20, 2025 17:54
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