Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Course
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
Newsletter Archive
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Newsletter #254: Pydantic v2.12: Skip Computed Fields During Serialization

Newsletter #254: Pydantic v2.12: Skip Computed Fields During Serialization


๐Ÿ“… Today’s Picks

Pydantic v2.12: Skip Computed Fields During Serialization

Code example: Pydantic v2.12: Skip Computed Fields During Serialization

Problem

By default, Pydantic’s model_dump() serializes computed fields alongside the base fields used to derive them.

This duplicates data and increases API response sizes.

Solution

Pydantic v2.12 adds the exclude_computed_fields parameter to model_dump().

This lets you keep computed fields for internal use while excluding them from API responses.


โ˜•๏ธ Weekly Finds

llm-council [LLM] – Query multiple LLMs in parallel, anonymize responses, and have them rank each other for better answers

skweak [ML] – Build NER models without labeled data using weak supervision for NLP tasks

wrapt [Python Utils] – Create transparent decorators, wrappers, and monkey patches in Python

Looking for a specific tool? Explore 70+ Python tools โ†’

Stay Current with CodeCut

Actionable Python tips, curated for busy data pros. Skim in under 2 minutes, three times a week.

Leave a Comment

Your email address will not be published. Required fields are marked *

0
    0
    Your Cart
    Your cart is empty
    Scroll to Top

    Work with Khuyen Tran

    Work with Khuyen Tran