Skip to content

Build the types for serialization checks once at import time - #1045

Merged
sebastian-goeldi merged 1 commit into
gdsfactory:mainfrom
abdelq:abdelq/pyzzsmnv
Aug 14, 2026
Merged

Build the types for serialization checks once at import time#1045
sebastian-goeldi merged 1 commit into
gdsfactory:mainfrom
abdelq:abdelq/pyzzsmnv

Conversation

@abdelq

@abdelq abdelq commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

When using nested types with a lot of elements, profiling showed a lot of time was just spent on the type union per isinstance call. It gets costly.

I'd appreciate it if a patch release is made for this one :)

Test Plan

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.16%. Comparing base (e298e13) to head (58ea98d).

Files with missing lines Patch % Lines
src/kfactory/serialization.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1045      +/-   ##
==========================================
- Coverage   71.19%   71.16%   -0.04%     
==========================================
  Files          74       74              
  Lines       15177    15181       +4     
  Branches     2960     2960              
==========================================
- Hits        10806    10804       -2     
- Misses       3441     3444       +3     
- Partials      930      933       +3     

☔ View full report in Codecov by Harness.
📢 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.

@abdelq abdelq changed the title Build the types for serialization once at import time Build the types for serialization checks once at import time Aug 14, 2026
@sebastian-goeldi

Copy link
Copy Markdown
Collaborator

hmm, fair. wouldn't it be sufficient to build the union type once outside?

@sebastian-goeldi sebastian-goeldi added the bug Something isn't working label Aug 14, 2026
@sebastian-goeldi
sebastian-goeldi merged commit 3ba3795 into gdsfactory:main Aug 14, 2026
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants