Avatar for the pydantic user
pydantic
pydantic
BlogDocsChangelog

Add default factory with validated data to PrivateAttr

#11685
Comparing
andresliszt:add/validated-data-to-private-factory
(
312c1ab
) with
main
(
bf06866
)
CodSpeed Performance Gauge
0%
Untouched
46
Ignored
2

Benchmarks

Passed

test_list_of_models_validation[model_validate]
tests/benchmarks/test_model_validation.py::test_list_of_models_validation[model_validate]
CodSpeed Performance Gauge
+1%
80 µs79 µs
test_complex_model_validation[model_validate]
tests/benchmarks/test_model_validation.py::test_complex_model_validation[model_validate]
CodSpeed Performance Gauge
+1%
51.7 µs51.2 µs
test_complex_model_validation[__init__]
tests/benchmarks/test_model_validation.py::test_complex_model_validation[__init__]
CodSpeed Performance Gauge
+1%
50.2 µs49.6 µs
test_simple_model_validation[__init__]
tests/benchmarks/test_model_validation.py::test_simple_model_validation[__init__]
CodSpeed Performance Gauge
+1%
37.3 µs37.1 µs
test_nested_model_validation[model_validate]
tests/benchmarks/test_model_validation.py::test_nested_model_validation[model_validate]
CodSpeed Performance Gauge
+1%
51 µs50.7 µs
test_north_star_validate_python_strict
tests/benchmarks/test_north_star.py::test_north_star_validate_python_strict
CodSpeed Performance Gauge
0%
23.6 ms23.5 ms
test_nested_model_validation[__init__]
tests/benchmarks/test_model_validation.py::test_nested_model_validation[__init__]
CodSpeed Performance Gauge
0%
53 µs52.8 µs
test_fastapi_startup_perf
tests/benchmarks/test_fastapi_startup_generics.py::test_fastapi_startup_perf
CodSpeed Performance Gauge
0%
84.1 ms83.8 ms
test_recursive_discriminated_union_with_base_model
tests/benchmarks/test_model_schema_generation_recursive.py::test_recursive_discriminated_union_with_base_model
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
test_model_validators_serializers
tests/benchmarks/test_model_schema_generation.py::test_model_validators_serializers
CodSpeed Performance Gauge
0%
769.7 µs767.1 µs
test_simple_recursive_model_schema_generation
tests/benchmarks/test_model_schema_generation_recursive.py::test_simple_recursive_model_schema_generation
CodSpeed Performance Gauge
0%
629.6 µs627.6 µs
test_nested_recursive_model_schema_generation
tests/benchmarks/test_model_schema_generation_recursive.py::test_nested_recursive_model_schema_generation
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
test_tagged_union_with_str_discriminator_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_tagged_union_with_str_discriminator_schema_generation
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_generic_recursive_model_schema_generation
tests/benchmarks/test_model_schema_generation_recursive.py::test_generic_recursive_model_schema_generation
CodSpeed Performance Gauge
0%
755.5 µs754.2 µs
test_north_star_validate_python
tests/benchmarks/test_north_star.py::test_north_star_validate_python
CodSpeed Performance Gauge
0%
38.9 ms38.8 ms
test_schema_build
tests/benchmarks/test_discriminated_unions.py::test_schema_build
CodSpeed Performance Gauge
0%
2.7 ms2.7 ms
test_isinstance_basemodel
tests/benchmarks/test_isinstance.py::test_isinstance_basemodel
CodSpeed Performance Gauge
0%
26.6 ms26.6 ms
test_setattr
tests/benchmarks/test_attribute_access.py::test_setattr
CodSpeed Performance Gauge
0%
89.8 µs89.7 µs
test_fastapi_startup_perf
tests/benchmarks/test_fastapi_startup_simple.py::test_fastapi_startup_perf
CodSpeed Performance Gauge
0%
19.9 ms19.9 ms
test_north_star_validate_json_strict
tests/benchmarks/test_north_star.py::test_north_star_validate_json_strict
CodSpeed Performance Gauge
0%
39.2 ms39.2 ms
test_north_star_validate_json
tests/benchmarks/test_north_star.py::test_north_star_validate_json
CodSpeed Performance Gauge
0%
39.2 ms39.2 ms
test_north_star_json_dumps
tests/benchmarks/test_north_star.py::test_north_star_json_dumps
CodSpeed Performance Gauge
0%
23.6 ms23.6 ms
test_north_star_dump_json
tests/benchmarks/test_north_star.py::test_north_star_dump_json
CodSpeed Performance Gauge
0%
30.3 ms30.3 ms
test_simple_model_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_simple_model_schema_generation
CodSpeed Performance Gauge
0%
629.3 µs629.1 µs
test_north_star_json_loads
tests/benchmarks/test_north_star.py::test_north_star_json_loads
CodSpeed Performance Gauge
0%
19.6 ms19.6 ms
test_construct_dataclass_schema
tests/benchmarks/test_model_schema_generation.py::test_construct_dataclass_schema
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_tagged_union_with_callable_discriminator_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_tagged_union_with_callable_discriminator_schema_generation
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_nested_recursive_generic_model_schema_generation
tests/benchmarks/test_model_schema_generation_recursive.py::test_nested_recursive_generic_model_schema_generation
CodSpeed Performance Gauge
0%
1.4 ms1.4 ms
test_deeply_nested_recursive_model_schema_generation
tests/benchmarks/test_model_schema_generation_recursive.py::test_deeply_nested_recursive_model_schema_generation
CodSpeed Performance Gauge
0%
1.3 ms1.3 ms
test_nested_model_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_nested_model_schema_generation
CodSpeed Performance Gauge
0%
836 µs836.4 µs
test_getattr
tests/benchmarks/test_attribute_access.py::test_getattr
CodSpeed Performance Gauge
0%
54.8 µs54.8 µs
test_recursive_model_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_recursive_model_schema_generation
CodSpeed Performance Gauge
0%
855.2 µs856.1 µs
test_lots_of_models_with_lots_of_fields
tests/benchmarks/test_model_schema_generation.py::test_lots_of_models_with_lots_of_fields
CodSpeed Performance Gauge
0%
2 s2 s
test_simple_model_validation[model_validate]
tests/benchmarks/test_model_validation.py::test_simple_model_validation[model_validate]
CodSpeed Performance Gauge
0%
39.7 µs39.7 µs
test_efficiency_with_highly_nested_examples
tests/benchmarks/test_discriminated_unions.py::test_efficiency_with_highly_nested_examples
CodSpeed Performance Gauge
0%
711 µs712.2 µs
test_model_json_serialization
tests/benchmarks/test_model_serialization.py::test_model_json_serialization
CodSpeed Performance Gauge
0%
49.1 µs49.2 µs
test_simple_model_schema_lots_of_fields_generation
tests/benchmarks/test_model_schema_generation.py::test_simple_model_schema_lots_of_fields_generation
CodSpeed Performance Gauge
0%
22.9 ms22.9 ms
test_complex_model_schema_generation
tests/benchmarks/test_model_schema_generation.py::test_complex_model_schema_generation
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
test_import_basemodel
tests/benchmarks/test_imports.py::test_import_basemodel
CodSpeed Performance Gauge
0%
26.1 µs26.1 µs
test_north_star_dump_python
tests/benchmarks/test_north_star.py::test_north_star_dump_python
CodSpeed Performance Gauge
0%
17.2 ms17.3 ms
test_list_of_models_serialization
tests/benchmarks/test_model_serialization.py::test_list_of_models_serialization
CodSpeed Performance Gauge
0%
54.2 µs54.3 µs
test_simple_model_serialization
tests/benchmarks/test_model_serialization.py::test_simple_model_serialization
CodSpeed Performance Gauge
0%
32 µs32.1 µs
test_import_field
tests/benchmarks/test_imports.py::test_import_field
CodSpeed Performance Gauge
0%
25.9 µs26 µs
test_complex_model_serialization
tests/benchmarks/test_model_serialization.py::test_complex_model_serialization
CodSpeed Performance Gauge
0%
43.8 µs44 µs
test_failed_rebuild
tests/benchmarks/test_model_schema_generation.py::test_failed_rebuild
CodSpeed Performance Gauge
-1%
212.4 µs213.8 µs
test_list_of_models_validation[__init__]
tests/benchmarks/test_model_validation.py::test_list_of_models_validation[__init__]
CodSpeed Performance Gauge
-1%
81.4 µs82 µs

Ignored

test_nested_model_serialization
tests/benchmarks/test_model_serialization.py::test_nested_model_serialization
Ignored
CodSpeed Performance Gauge
0%
40.8 µs40.9 µs
test_field_validators_serializers
tests/benchmarks/test_model_schema_generation.py::test_field_validators_serializers
Ignored
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms

Commits

Click on a commit to change the comparison range
Base
main
bf06866
+0.08%
improve docs
f426ad6
5 months ago
by andresliszt
-0.13%
fix typing
a715df7
5 months ago
by andresliszt
+0.14%
fix typing
312c1ab
5 months ago
by andresliszt
© 2025 CodSpeed Technology
Home Terms Privacy Docs