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

migrate pydantic #295

Merged
merged 6 commits into from
Oct 1, 2024
Merged

migrate pydantic #295

merged 6 commits into from
Oct 1, 2024

Conversation

robsdavis
Copy link
Contributor

@robsdavis robsdavis commented Sep 27, 2024

Description

This branch migrates from pydantic version 1.X to 2.X. This requires significant changes to the schema and distribution classes (core classes in synthcity's logic).
This closes #296.
Minor point: We also abstract n_folds to close #280.

Main changes

  • distribution class
    • Update _validate_marginal_distribution to accept FieldValidationInfo type for values parameter
    • Handle random sampling using new PrivateAttr _rng. Implemented new initialize_rng function to enable this
    • Updated validation throughout
    • New PassThroughDistribution
  • Automated updates to validation decorators
    • tabular_encoder, constraints
  • Allow plugin to handle protected column explicitly using PassThroughDistribution
  • Schema class
    • Completely re-written with new validation
    • New _infer_domain method
  • Update tests to work with updated classes
    • test_schema
    • test_distribution

Affected Dependencies

Removed the version pin on pydantic

How has this been tested?

The standard battery of tests, but with some small changes to the tests to make them compatible with new logic.

Checklist

@robsdavis robsdavis added enhancement New feature or request dependencies Pull requests that update a dependency file labels Sep 27, 2024
@robsdavis robsdavis self-assigned this Sep 27, 2024
@robsdavis robsdavis marked this pull request as draft September 27, 2024 16:58
@robsdavis robsdavis marked this pull request as ready for review October 1, 2024 11:54
@robsdavis robsdavis merged commit d536d2e into main Oct 1, 2024
10 checks passed
@robsdavis robsdavis deleted the typing-validation branch October 1, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to pydantic v2.X Add argument n_folds in Benchmark.evaluate() function
1 participant