Skip to content

Commit

Permalink
Merge pull request #182 from NREL/dt/upgrade-pydantic
Browse files Browse the repository at this point in the history
Upgrade pydantic to v2
  • Loading branch information
daniel-thom authored Nov 22, 2023
2 parents b4a9136 + 4716669 commit 986ceed
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 16 deletions.
6 changes: 2 additions & 4 deletions disco/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from enum import Enum
from typing import List, Optional, Union, Set

from pydantic.class_validators import validator, root_validator
from pydantic.fields import Field
from pydantic.main import BaseModel
from pydantic.types import DirectoryPath, FilePath
from pydantic.v1 import validator, root_validator, Field, BaseModel
from pydantic.v1.types import DirectoryPath, FilePath

from jade.utils.utils import ExtendedJSONEncoder, standardize_timestamp
from PyDSS.common import ControllerType
Expand Down
2 changes: 1 addition & 1 deletion disco/models/power_flow_generic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from typing import Dict, List, Optional, Set

from pydantic import BaseModel, Field, root_validator, validator
from pydantic.v1 import BaseModel, Field, root_validator, validator

from jade.utils.utils import load_data

Expand Down
2 changes: 1 addition & 1 deletion disco/models/snapshot_impact_analysis_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Optional

from pydantic.fields import Field
from pydantic.v1 import Field

from .base import ImpactAnalysisBaseModel

Expand Down
2 changes: 1 addition & 1 deletion disco/models/time_series_analysis_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Optional

from pydantic.fields import Field
from pydantic.v1 import Field

from .base import ImpactAnalysisBaseModel

Expand Down
4 changes: 2 additions & 2 deletions disco/models/upgrade_cost_analysis_equipment_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any
from pathlib import Path
from typing import Optional, List
from pydantic import BaseModel, Field, validator
from pydantic.v1 import BaseModel, Field, validator

from jade.utils.utils import load_data

Expand Down Expand Up @@ -551,4 +551,4 @@ class ExtraTransformerParams(BaseModel):
title="amp_limit_per_phase",
description="amp_limit_per_phase. This is a new field, not a direct OpenDSS object property.",
determine_upgrade_option=True,
)
)
3 changes: 2 additions & 1 deletion disco/models/upgrade_cost_analysis_generic_input_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List, Optional, Set, Dict
from pydantic import Field, root_validator, validator, ValidationError
from pydantic.v1 import Field, root_validator, validator
from pydantic.v1.error_wrappers import ValidationError

import pandas as pd

Expand Down
2 changes: 1 addition & 1 deletion disco/models/upgrade_cost_analysis_generic_output_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
import logging
from typing import List, Optional, Set, Dict, Any
from pydantic import Field
from pydantic.v1 import Field

from disco.models.upgrade_cost_analysis_equipment_model import UpgradeParamsBaseModel, ExtraLineParams, ExtraTransformerParams
from disco.models.upgrade_cost_analysis_generic_input_model import OpenDSSLineModel, OpenDSSTransformerModel
Expand Down
2 changes: 1 addition & 1 deletion disco/models/upgrade_cost_analysis_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from pydantic.fields import Field
from pydantic.v1 import Field

from disco.models.base import (
BaseAnalysisModel,
Expand Down
2 changes: 1 addition & 1 deletion disco/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.2"
__version__ = "0.5.0"
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ def install_jade_extensions():
version = lines[0].split()[2].strip('"').strip("'")

install_requires = [
"NREL-jade~=0.9.3",
"NREL-jade~=0.10.0",
"chevron~=0.14.0",
"click~=8.0",
"dsspy~=2.3.0",
"dsspy~=3.0.0",
"filelock~=3.8",
"matplotlib~=3.6",
"networkx~=2.8",
"opendssdirect.py~=0.8.4",
"openpyxl~=3.0",
"pandas~=1.5.0",
"pydantic~=1.6",
"pydantic~=2.5.2",
"seaborn~=0.12.1",
"scikit-learn~=1.1",
"sqlalchemy~=1.4",
Expand Down

0 comments on commit 986ceed

Please sign in to comment.