-
Notifications
You must be signed in to change notification settings - Fork 66
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
Respect repr on fields when logging a dataclass #592
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 133 133
Lines 10448 10452 +4
Branches 1430 1431 +1
=========================================
+ Hits 10448 10452 +4 ☔ View full report in Codecov by Sentry. |
tests/test_json_args.py
Outdated
@dataclass | ||
class MyReprDataclass: | ||
in_repr: int | ||
not_in_repr: int = field(repr=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a complex object that would appear in the json schema.
then ensure it doesn't appear in the json schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, it does misbehave :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, I think. And I check there was nowhere else we use the dataclasses.fields function, so I think it should be good now.
Deploying logfire-docs with Cloudflare Pages
|
Requested by @samuelcolvin.
I think it maybe makes sense to have a way for users to control this behavior more explicitly/independently of other use cases (e.g., via a magic
__pydantic_logfire_dump__
method?). But this seems reasonable to me for now. Not sure if we need to be concerned about it being a breaking change, or need to provide a way to opt into it or something.field(repr=False)
should not be serialized/shown #521