Skip to content

feat: add the fmt_tf() formatting method#665

Merged
rich-iannone merged 29 commits into
mainfrom
feat-fmt-tf
Jun 13, 2025
Merged

feat: add the fmt_tf() formatting method#665
rich-iannone merged 29 commits into
mainfrom
feat-fmt-tf

Conversation

@rich-iannone
Copy link
Copy Markdown
Member

This PR adds the fmt_tf() formatting method, which is meant for formatting boolean values in a column.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 93.75000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.25%. Comparing base (82226ea) to head (60e4785).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
great_tables/_formats.py 93.67% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #665      +/-   ##
==========================================
+ Coverage   91.20%   91.25%   +0.05%     
==========================================
  Files          47       47              
  Lines        5478     5556      +78     
==========================================
+ Hits         4996     5070      +74     
- Misses        482      486       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot temporarily deployed to pr-665 April 11, 2025 03:44 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 April 14, 2025 16:51 Destroyed
Comment thread great_tables/_formats.py
A formatting pattern that allows for decoration of the formatted value. The formatted value
is represented by the `{x}` (which can be used multiple times, if needed) and all other
characters will be interpreted as string literals.
true_val
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In numpydoc style, I think you can do something like...

    true_val, false_val
        Some explanation for both

(But I could be wrong, and also maybe quartodoc is not handling it right 😅 )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

From pairing, it looks like this works (although the parameters still have separate lines in the parameter list). let's try to get this working. We might need to unpin griffe

Comment thread great_tables/_formats.py Outdated
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 15:28 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 15:39 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 15:41 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 15:59 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 16:49 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 16:51 Destroyed
@rich-iannone rich-iannone marked this pull request as ready for review May 6, 2025 17:31
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 17:37 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 17:46 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 May 6, 2025 17:48 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 12:47 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 12:58 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 13:02 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 13:17 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 15:25 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 15:28 Destroyed
Comment thread great_tables/_formats.py Outdated
elif is_na(data._tbl_data, x):
return self.na_color
else:
raise ValueError(f"Unexpected value type: {type(x)}")
Copy link
Copy Markdown
Collaborator

@machow machow Jun 9, 2025

Choose a reason for hiding this comment

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

This looks like it the TypeError

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now changed to TypeError.

Comment thread great_tables/_formats.py Outdated
raise ValueError(f"Unexpected value type: {type(x)}")


def from_colors_list(colors: list[str]) -> TfColorMap:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would make this a class method

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed during code review.

@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 18:26 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 18:31 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 18:43 Destroyed
@github-actions github-actions Bot temporarily deployed to pr-665 June 9, 2025 20:27 Destroyed
@rich-iannone rich-iannone requested a review from machow June 9, 2025 20:42
Copy link
Copy Markdown
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

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

This LGTM, I didn't look too closely at the changes (but we did a lot of them while pairing).

@rich-iannone rich-iannone self-assigned this Jun 13, 2025
@rich-iannone rich-iannone merged commit 602b196 into main Jun 13, 2025
14 checks passed
@rich-iannone rich-iannone deleted the feat-fmt-tf branch June 13, 2025 15:50
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.

2 participants