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

feat: move to Pydantic 2.0 and use the 1.10 patch branch #163

Merged
merged 7 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/dependent-tests.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class PulseFunctionArgument(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading
Loading