Skip to content
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

feat: support for evented containers as pydantic v2 fields #283

Merged
merged 1 commit into from
Feb 24, 2024

Conversation

tlambert03
Copy link
Member

@tlambert03 tlambert03 commented Feb 24, 2024

This is in support of #252, where I noted that evented containers don't work well as fields for pydantic models. Specifically, this enables:

class Model(pydantic.BaseModel):
    my_list: psygnal.containers.EventedList[int]  # or other evented containers

This only supports pydantic v2 (for now, and probably forever), since pydantic v1 always had very bad support for custom Generic fields

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8f44f34) to head (b239e9a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #283   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         1864      1880   +16     
=========================================
+ Hits          1864      1880   +16     

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

Copy link

codspeed-hq bot commented Feb 24, 2024

CodSpeed Performance Report

Merging #283 will not alter performance

Comparing tlambert03:pydantic-fields (b239e9a) with main (8f44f34)

Summary

✅ 66 untouched benchmarks

@tlambert03 tlambert03 added the enhancement New feature or request label Feb 24, 2024
@tlambert03 tlambert03 merged commit 0a6f41a into pyapp-kit:main Feb 24, 2024
54 checks passed
@tlambert03 tlambert03 deleted the pydantic-fields branch February 24, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

1 participant