Skip to content

Commit

Permalink
feat: move to Pydantic 2.0 and use the 1.10 patch branch (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
math411 committed Mar 27, 2024
1 parent 66d5f0e commit 43d89ed
Show file tree
Hide file tree
Showing 157 changed files with 166 additions and 166 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dependent-tests.yml
Expand Up @@ -13,8 +13,6 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
dependent:
- amazon-braket-default-simulator-python
- amazon-braket-sdk-python
- amazon-braket-pennylane-plugin-python

steps:
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -26,22 +26,22 @@
python_requires=">= 3.9",
packages=find_namespace_packages(where="src", exclude=("test",)),
package_dir={"": "src"},
install_requires=["pydantic >=1.8.2, <2.0.0"],
install_requires=["pydantic>2"],
extras_require={
"test": [
"black",
"flake8",
"flake8-rst-docstrings",
"isort",
"jsonschema==3.2.0",
"jsonschema",
"numpy",
"pre-commit",
"pylint",
"pytest",
"pytest-cov",
"pytest-rerunfailures",
"pytest-xdist",
"sphinx < 3.0.0",
"sphinx",
"sphinx-rtd-theme",
"sphinxcontrib-apidoc",
"tox",
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List

from pydantic import conlist, constr
from pydantic.v1 import conlist, constr

from braket.device_schema.device_action_properties import DeviceActionProperties
from braket.device_schema.result_type import ResultType
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, List

from pydantic import Field
from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/device_action_properties.py
Expand Up @@ -14,7 +14,7 @@
from enum import Enum
from typing import List, Union

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class DeviceActionType(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/device_capabilities.py
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, Union

from pydantic import BaseModel
from pydantic.v1 import BaseModel

from braket.device_schema.device_action_properties import DeviceActionProperties, DeviceActionType
from braket.device_schema.device_service_properties_v1 import DeviceServiceProperties
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/device_connectivity.py
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class DeviceConnectivity(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/device_execution_window.py
Expand Up @@ -15,7 +15,7 @@
from enum import Enum
from typing import Union

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class ExecutionDay(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/device_service_properties_v1.py
Expand Up @@ -14,7 +14,7 @@
from datetime import datetime
from typing import List, Optional, Tuple

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

from braket.device_schema.device_execution_window import DeviceExecutionWindow
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List, Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.dwave.dwave_provider_level_parameters_v1 import (
PostProcessingType,
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.dwave.dwave_2000Q_device_level_parameters_v1 import (
Dwave2000QDeviceLevelParameters,
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List, Optional

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.dwave.dwave_provider_level_parameters_v1 import ResultFormat
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.dwave.dwave_advantage_device_level_parameters_v1 import (
DwaveAdvantageDeviceLevelParameters,
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_capabilities import DeviceCapabilities
from braket.device_schema.dwave.dwave_provider_properties_v1 import DwaveProviderProperties
Expand Down
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
from typing import Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.dwave.dwave_2000Q_device_level_parameters_v1 import (
Dwave2000QDeviceLevelParameters,
Expand Down
Expand Up @@ -14,7 +14,7 @@
from enum import Enum
from typing import List, Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List

from pydantic import Field
from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class ErrorMitigationProperties(BaseModel):
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class ErrorMitigationScheme(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/gate_model_parameters_v1.py
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field, conint
from pydantic.v1 import Field, conint

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_connectivity import DeviceConnectivity
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
Expand Up @@ -14,7 +14,7 @@
import json
from typing import Dict, Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_action_properties import DeviceActionType
from braket.device_schema.device_capabilities import DeviceCapabilities
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/ionq/ionq_device_parameters_v1.py
Expand Up @@ -14,7 +14,7 @@
from importlib import import_module
from typing import List, Optional

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

from braket.device_schema.error_mitigation.error_mitigation_scheme import ErrorMitigationScheme
from braket.device_schema.gate_model_parameters_v1 import GateModelParameters
Expand Down
Expand Up @@ -15,7 +15,7 @@
from importlib import import_module
from typing import Dict, Optional, Type

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.error_mitigation.error_mitigation_properties import (
ErrorMitigationProperties,
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/jaqcd_device_action_properties.py
Expand Up @@ -13,7 +13,7 @@

from typing import List, Optional

from pydantic import constr
from pydantic.v1 import constr

from braket.device_schema.device_action_properties import DeviceActionProperties
from braket.device_schema.result_type import ResultType
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import List, Optional

from pydantic import constr
from pydantic.v1 import constr

from braket.device_schema.device_action_properties import DeviceActionProperties
from braket.device_schema.result_type import ResultType
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/oqc/oqc_device_capabilities_v1.py
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_action_properties import DeviceActionType
from braket.device_schema.device_capabilities import DeviceCapabilities
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/oqc/oqc_device_parameters_v1.py
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.gate_model_parameters_v1 import GateModelParameters
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/oqc/oqc_provider_properties_v1.py
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, List, TypeVar, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/pulse/frame_v1.py
@@ -1,6 +1,6 @@
from typing import Any, Dict, List, Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class Frame(BaseModel):
Expand Down
@@ -1,6 +1,6 @@
from typing import Any, Dict, List, Optional, Tuple, Union

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

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/pulse/port_v1.py
@@ -1,7 +1,7 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Set

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class Direction(Enum):
Expand Down
@@ -1,6 +1,6 @@
from typing import Dict, Optional

from pydantic import AnyUrl, Field
from pydantic.v1 import AnyUrl, Field

from braket.device_schema.pulse.frame_v1 import Frame
from braket.device_schema.pulse.port_v1 import Port
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/pulse/pulse_function_v1.py
@@ -1,6 +1,6 @@
from typing import List, Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class PulseFunctionArgument(BaseModel):
Expand Down
Expand Up @@ -14,7 +14,7 @@
from decimal import Decimal
from typing import Annotated, List, Tuple

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

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.


from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_capabilities import DeviceCapabilities
from braket.device_schema.quera.quera_ahs_paradigm_properties_v1 import QueraAhsParadigmProperties
Expand Down
2 changes: 1 addition & 1 deletion src/braket/device_schema/result_type.py
Expand Up @@ -13,7 +13,7 @@

from typing import List, Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class ResultType(BaseModel):
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, Optional, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_action_properties import DeviceActionType
from braket.device_schema.device_capabilities import DeviceCapabilities
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.gate_model_parameters_v1 import GateModelParameters
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import Dict

from pydantic import Field
from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down
Expand Up @@ -13,7 +13,7 @@

from typing import Dict, Union

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.device_action_properties import DeviceActionType
from braket.device_schema.device_capabilities import DeviceCapabilities
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field
from pydantic.v1 import Field

from braket.device_schema.gate_model_parameters_v1 import GateModelParameters
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
Expand Down
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from pydantic import Field, conint
from pydantic.v1 import Field, conint

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader

Expand Down

0 comments on commit 43d89ed

Please sign in to comment.