Skip to content

Conversation

FBruzzesi
Copy link
Member

@FBruzzesi FBruzzesi commented Sep 10, 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

@FBruzzesi FBruzzesi added the enhancement New feature or request label Sep 10, 2025
dangotbanned added a commit that referenced this pull request Sep 11, 2025
Possibly helpful for #3116 (comment)

Includes version handling via [`module.__getattr__`](https://docs.python.org/3/reference/datamodel.html#module.__getattr__)

### Note
I'm not gonna push back if we explicitly **don't** want this one encouraged 😂:
- #2370
- #2729
@FBruzzesi FBruzzesi changed the title feat: Add support for {Expr,Series}.str.to_titlecase for non sql-like backends feat: Add support for {Expr,Series}.str.to_titlecase Sep 11, 2025
@FBruzzesi FBruzzesi marked this pull request as ready for review September 11, 2025 14:32
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.

pretty neat, thanks!

dangotbanned added a commit that referenced this pull request Sep 12, 2025
- Towards #3116 (comment)
- Typing is easy to fix
@dangotbanned dangotbanned self-requested a review September 21, 2025 15:02
Copy link
Member

@dangotbanned dangotbanned left a comment

Choose a reason for hiding this comment

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

Thanks @FBruzzesi - a few notes/suggestions from me - but looking good 🥳

Comment on lines +38 to +51
def to_titlecase(self) -> SparkLikeExpr:
impl = self.compliant._implementation
sqlframe_required_version = (3, 43, 1)
if (
impl.is_sqlframe()
and (version := impl._backend_version()) < sqlframe_required_version
): # pragma: no cover
required_str = requires._unparse_version(sqlframe_required_version)
found_str = requires._unparse_version(version)
msg = (
f"`str.to_titlecase` is only available in 'sqlframe>={required_str}', "
f"found version {found_str!r}."
)
raise NotImplementedError(msg)
Copy link
Member

Choose a reason for hiding this comment

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

I guess this would be a case that #3059 would be nice for?

This'll do for now though 😄

@dangotbanned dangotbanned self-requested a review October 6, 2025 08:26
Copy link
Member

@dangotbanned dangotbanned left a comment

Choose a reason for hiding this comment

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

Thanks @FBruzzesi, my suggestions aren't blocking - looking great

banarwhal

Co-authored-by: Dan Redding <[email protected]>
@FBruzzesi FBruzzesi merged commit 51b3302 into main Oct 6, 2025
31 of 33 checks passed
@FBruzzesi FBruzzesi deleted the feat/str-to-titlecase branch October 6, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enh: str.to_titlecase
3 participants