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

Refactor root_validator to model_validator #37

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

edwardxtg
Copy link
Contributor

Use model_validator instead of root_validator

Copy link

Copy link
Contributor

@Lkruitwagen Lkruitwagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@edwardxtg edwardxtg merged commit 15662aa into main Feb 13, 2024
1 check passed
@edwardxtg edwardxtg deleted the refactor/pydantic2_validators branch February 13, 2024 12:17
Lkruitwagen added a commit that referenced this pull request Feb 22, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* Correct name on test_timedefinition_construction_failcases()

* docs: clarify any-of

* docs: clarify objects

* testing: delint

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 23, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* fix: rebase duplicate

* tests: skip model construction for now

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 23, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* More descriptive commodity validation error message

* Add descriptions to commodity failing test data

* tests: cleanup

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 23, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* feat: make data construction more flexible

* feat: build and test impact construction

* tests: impact otoole roundtrip

* fix: some cleanup on commodity testing

* Description for impact fail test cases

* add id to impact validation

* fix: catch nested data on construction

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 29, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* feat: make data construction more flexible

* feat: build and test impact construction

* tests: impact otoole roundtrip

* fix: some cleanup on commodity testing

* tests: touchup test-impact

* tests: technology construction

* feat: otoole compatability for technology

* feat: add to defaults

* feat: region and impact compat

* feat: validation for technology

* Add failing test case descriptions

* update validation utils check_min_vals_lower_max() to handle single values.

* fix: merge mistakes

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 29, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* feat: make data construction more flexible

* feat: build and test impact construction

* tests: impact otoole roundtrip

* fix: some cleanup on commodity testing

* tests: touchup test-impact

* tests: technology construction

* feat: otoole compatability for technology

* feat: add to defaults

* feat: region and impact compat

* feat: validation for technology

* tests: runspec construction and roundtrip

* feat: add defaults for discount rate depreciation method

* feat: instantiate RunSpec on load model

* feat: add a depreciation_method enum

* feat: include reserve margin in commodity and technology defn

* feat: otoole compatability for RunSpec and Technology

* fix: return 'self' from model_validator(mode='after')

* feat: finish RunSpec model

* tests: roundtrip and yaml compatability

* fix: merge issues

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 29, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* feat: make data construction more flexible

* feat: build and test impact construction

* tests: impact otoole roundtrip

* fix: some cleanup on commodity testing

* tests: touchup test-impact

* tests: technology construction

* feat: otoole compatability for technology

* feat: add to defaults

* feat: region and impact compat

* feat: validation for technology

* tests: runspec construction and roundtrip

* feat: add defaults for discount rate depreciation method

* feat: instantiate RunSpec on load model

* feat: add a depreciation_method enum

* feat: include reserve margin in commodity and technology defn

* feat: otoole compatability for RunSpec and Technology

* fix: return 'self' from model_validator(mode='after')

* feat: finish RunSpec model

* tests: roundtrip and yaml compatability

* feat: add data casting for OSeMOSYSData

* refactor into composeable OSeMOSYSData class

* refactor: move otoole time_defn to compat

* feat: test commodity composition

* tests: rename composition base test

* feat: add dtype to operating mode vars

* feat: refactor compose

* feat: compose technologies

* feat: compose all schema

* tests: runspec composition

* fix: simplify yaml to start with passing case

* feat: load model yaml

* fix: create timedefinition from yearparts and dayparts

* additional fail cases test_compose_base.py

* additional fail cases test_runspec.py

* fix: delint

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
Lkruitwagen added a commit that referenced this pull request Feb 29, 2024
* tests: base oseomosys construction

* feat: improvement to base abstraction

* feat: add validation for time_defintion

* tests: for time_definition

* add test_otoole_roundtrip pytest

* [SMS-239] cleanup noqa test data (#36)

* fix: rm otoole sample data from tests

* feat: import utils by name

* fix: cleanup some DS store

* fix: import utils

* Refactor root_validator to model_validator (#37)

* tests: otoole_roundtrip

* feat: fitler pandas=3. dep warning

* tests: roundtrip otoole timedefn

* delint

* otoole_roundtrip as pytest

* fix: rename otoole-csv paths

* fix: make long_name and description optional

* tests: skip full otoole construction for now

* tests: test region construction

* feat: make base osemosys data built from args[0]

* fix: rm composable assumptions and targets for now

* fix: accidental rename

* fix: accident rename test case

* tests: commodity construction and compatability

* feat: begin refactor to /compat

* feat: add 'isnumeric' helper util

* refactor: defaults to initial import, don't import pydatnic schemas

* refactor: defaults and compat

* feat: commodity schema

* feat: make data construction more flexible

* feat: build and test impact construction

* tests: impact otoole roundtrip

* fix: some cleanup on commodity testing

* tests: touchup test-impact

* tests: technology construction

* feat: otoole compatability for technology

* feat: add to defaults

* feat: region and impact compat

* feat: validation for technology

* tests: runspec construction and roundtrip

* feat: add defaults for discount rate depreciation method

* feat: instantiate RunSpec on load model

* feat: add a depreciation_method enum

* feat: include reserve margin in commodity and technology defn

* feat: otoole compatability for RunSpec and Technology

* fix: return 'self' from model_validator(mode='after')

* feat: finish RunSpec model

* tests: roundtrip and yaml compatability

* feat: add data casting for OSeMOSYSData

* refactor into composeable OSeMOSYSData class

* refactor: move otoole time_defn to compat

* feat: test commodity composition

* tests: rename composition base test

* feat: add dtype to operating mode vars

* feat: refactor compose

* feat: compose technologies

* feat: compose all schema

* tests: runspec composition

* fix: simplify yaml to start with passing case

* feat: load model yaml

* fix: create timedefinition from yearparts and dayparts

* feat: restore direct dict expression

* feat: add string casting for dict keys

* feat: cast dict keys to str

* fix: delint

---------

Co-authored-by: edwardxtg <edwardxtg@gmail.com>
Co-authored-by: edwardxtg <71764756+edwardxtg@users.noreply.github.com>
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.

2 participants