From d29a45ca44da8bde596c713bef4303345123ae26 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 10 Sep 2024 14:47:25 +0100 Subject: [PATCH 1/4] Fix mypy type stub packages in pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fb850d..63b823f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,4 +39,4 @@ repos: hooks: - id: mypy name: MyPy - additional_dependencies: [types-all, pydantic~=1.10] + additional_dependencies: [types-PyYAML, pydantic~=1.10] From cc7703705b583c57b90f769446ea4c9828b1148c Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 10 Sep 2024 16:44:48 +0100 Subject: [PATCH 2/4] Ensure pydantic v2 is installed --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 63b823f..47b2f4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,4 +39,4 @@ repos: hooks: - id: mypy name: MyPy - additional_dependencies: [types-PyYAML, pydantic~=1.10] + additional_dependencies: [types-PyYAML, pydantic~=2] From f33e25b61f6d4b8d94a90b79535873bacd8e0a35 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 10 Sep 2024 23:45:07 +0100 Subject: [PATCH 3/4] Try different version specifier --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47b2f4a..3e442ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,4 +39,4 @@ repos: hooks: - id: mypy name: MyPy - additional_dependencies: [types-PyYAML, pydantic~=2] + additional_dependencies: [types-PyYAML, pydantic>=2] From f91c1361bda793e99a3f5080b139d51fd3fad79e Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 10 Sep 2024 23:51:15 +0100 Subject: [PATCH 4/4] Remove now-defunct parameter in pydantic generation --- tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 6a73468..c499713 100644 --- a/tasks.py +++ b/tasks.py @@ -23,7 +23,7 @@ def regenerate_models(_): for schema in schemas: print(schema) schema_path = Path(schema) - gen = pd.PydanticGenerator(schema, pydantic_version="2", verbose=True) + gen = pd.PydanticGenerator(schema, verbose=True) output = gen.serialize() with open(MODEL_DIRECTORY / f"{schema_path.name.strip('.yaml')}.py", "w") as f: f.writelines(output)