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

Add compatibility for multiple Pydantic versions #67

Closed
wants to merge 2 commits into from
Closed

Conversation

shaharbar1
Copy link
Collaborator

Changes:

  • Add pydantic_version_compact.py with _get_major_pydantic_version function to handle version-specific logic.
  • Updated test cases to use pydantic_version_compatibility for version compatibility.
  • Adjusted error handling in tests to accommodate different Pydantic versions.
  • Refactored imports and added necessary logic to support both Pydantic v1 and v2.
  • Updated continuous integration and delivery workflows to test for both version of pydantic.

…d Validation (#35)

### Changes
 * Moved Strategy, Model, and MAB to strategy.py, model.py, and to the new mab.py. base.py is now only for definitions and abstract PyBanditsBaseModel. The abstract MAB now allows for all childs to either accept strategy instance as parameter, or to get the strategy parameters and instantiate correspondingly.
 * The from_state functionality is now directly inherited by all MABs from BaseMab.
 * Replaced all cold_start methods in cmab.py and smab.py with cold_start stemming from BaseMab. Correspondingly, updated test cases to use the new cold_start_instantiate methods.
 * Introduced numerize_field and get_expected_value_from_state methods in the Strategy class to handle default values and state extraction. Added field_validator for exploit_p in BestActionIdentification and subsidy_factor in CostControlBandit to ensure proper default handling and validation.
 * Merged common functionality into a new CostControlStrategy abstract class, which is now inherited by CostControlBandit and MultiObjectiveCostControlBandit. Simplified the select_action methods by using helper methods like _evaluate_and_select and _reduce.
 * Plugged get_pareto_front into a new MultiObjectiveStrategy abstract class, which is now inherited by MultiObjectiveBandit and MultiObjectiveCostControlBandit.
 * In model.py. Removed the redundant BaseBetaMO and BaseBayesianLogisticRegression. Added cold_start_instantiate method to BetaMO and BayesianLogisticRegression models.
 * Added extract_argument_names_from_function under utils.py to allow extract function parameter names by handle.
 * Changed test_base.py into test_mab.py.
 * Updated deprecated linter settings in pyproject.toml.
 * Added test_smab_mo_cc_update test on test_smab.py.
 * Changed version to 1.0.0 on pyproject.toml.
### Changes:
 * Add pydantic_version_compact.py with `_get_major_pydantic_version` function to handle version-specific logic.
 * Updated test cases to use `pydantic_version_compatibility` for version compatibility.
 * Adjusted error handling in tests to accommodate different Pydantic versions.
 * Refactored imports and added necessary logic to support both Pydantic v1 and v2.
 * Updated continuous integration and delivery workflows to test for both version of pydantic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant