From 643a1c81cf8158fda0cbeff9e315132b5f12c2e8 Mon Sep 17 00:00:00 2001 From: Max Chesterfield Date: Thu, 2 Apr 2026 09:16:59 +1100 Subject: [PATCH 1/3] license header generation Signed-off-by: Max Chesterfield --- pyproject.toml | 3 +- .../lib/ariadne_plugins/license_headers.py | 28 +++++++++++++++++++ .../lib/generated_graphql_client/__init__.py | 7 +++++ .../async_base_client.py | 7 +++++ .../generated_graphql_client/base_model.py | 7 +++++ .../base_operation.py | 7 +++++ .../lib/generated_graphql_client/client.py | 7 +++++ .../generated_graphql_client/custom_fields.py | 7 +++++ .../custom_mutations.py | 7 +++++ .../custom_queries.py | 7 +++++ .../custom_typing_fields.py | 7 +++++ .../eas/lib/generated_graphql_client/enums.py | 7 +++++ .../generated_graphql_client/exceptions.py | 7 +++++ .../generated_graphql_client/input_types.py | 7 +++++ 14 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/zepben/eas/lib/ariadne_plugins/license_headers.py diff --git a/pyproject.toml b/pyproject.toml index e455fba..aa82659 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,5 +67,6 @@ introspection_input_value_deprecations=true plugins=[ "zepben.eas.lib.ariadne_plugins.custom_query_type_hinter.CustomQueryTypeHinterPlugin", "zepben.eas.lib.ariadne_plugins.missed_import_checker.MissedImportCheckerPlugin", - "zepben.eas.lib.ariadne_plugins.gql_all_fields.GqlAllFieldsPlugin" + "zepben.eas.lib.ariadne_plugins.gql_all_fields.GqlAllFieldsPlugin", + "zepben.eas.lib.ariadne_plugins.license_headers.LicenseHeadersPlugin", ] diff --git a/src/zepben/eas/lib/ariadne_plugins/license_headers.py b/src/zepben/eas/lib/ariadne_plugins/license_headers.py new file mode 100644 index 0000000..671a4a8 --- /dev/null +++ b/src/zepben/eas/lib/ariadne_plugins/license_headers.py @@ -0,0 +1,28 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. +from datetime import datetime +from typing import Optional + +from ariadne_codegen import Plugin + +now = datetime.now() + +license = f"""# Copyright {now.year} Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. +""" + +class LicenseHeadersPlugin(Plugin): + + def get_file_comment( + self, comment: str, code: str, source: Optional[str] = None + ) -> str: + return f"{license}{comment}" + + def copy_code(self, copied_code: str) -> str: + return f"{license}\n\n{copied_code}" diff --git a/src/zepben/eas/lib/generated_graphql_client/__init__.py b/src/zepben/eas/lib/generated_graphql_client/__init__.py index a9a688b..f3c8fd0 100644 --- a/src/zepben/eas/lib/generated_graphql_client/__init__.py +++ b/src/zepben/eas/lib/generated_graphql_client/__init__.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from .async_base_client import AsyncBaseClient from .base_model import BaseModel, Upload from .client import Client diff --git a/src/zepben/eas/lib/generated_graphql_client/async_base_client.py b/src/zepben/eas/lib/generated_graphql_client/async_base_client.py index 7991c6e..d9d808c 100644 --- a/src/zepben/eas/lib/generated_graphql_client/async_base_client.py +++ b/src/zepben/eas/lib/generated_graphql_client/async_base_client.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + import asyncio import enum import json diff --git a/src/zepben/eas/lib/generated_graphql_client/base_model.py b/src/zepben/eas/lib/generated_graphql_client/base_model.py index 25d3444..9ede9d3 100644 --- a/src/zepben/eas/lib/generated_graphql_client/base_model.py +++ b/src/zepben/eas/lib/generated_graphql_client/base_model.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from io import IOBase from pydantic import BaseModel as PydanticBaseModel from pydantic import ConfigDict diff --git a/src/zepben/eas/lib/generated_graphql_client/base_operation.py b/src/zepben/eas/lib/generated_graphql_client/base_operation.py index 3219e1f..a18020e 100644 --- a/src/zepben/eas/lib/generated_graphql_client/base_operation.py +++ b/src/zepben/eas/lib/generated_graphql_client/base_operation.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional, Union from graphql import ArgumentNode, FieldNode, InlineFragmentNode, NamedTypeNode, NameNode, SelectionSetNode, VariableNode diff --git a/src/zepben/eas/lib/generated_graphql_client/client.py b/src/zepben/eas/lib/generated_graphql_client/client.py index fe0a69f..c6c3710 100644 --- a/src/zepben/eas/lib/generated_graphql_client/client.py +++ b/src/zepben/eas/lib/generated_graphql_client/client.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any from graphql import ( diff --git a/src/zepben/eas/lib/generated_graphql_client/custom_fields.py b/src/zepben/eas/lib/generated_graphql_client/custom_fields.py index 2b6873c..6e6ef27 100644 --- a/src/zepben/eas/lib/generated_graphql_client/custom_fields.py +++ b/src/zepben/eas/lib/generated_graphql_client/custom_fields.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional, Union from .base_operation import GraphQLField diff --git a/src/zepben/eas/lib/generated_graphql_client/custom_mutations.py b/src/zepben/eas/lib/generated_graphql_client/custom_mutations.py index e8306e0..9bf4a5c 100644 --- a/src/zepben/eas/lib/generated_graphql_client/custom_mutations.py +++ b/src/zepben/eas/lib/generated_graphql_client/custom_mutations.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional from .custom_fields import ( diff --git a/src/zepben/eas/lib/generated_graphql_client/custom_queries.py b/src/zepben/eas/lib/generated_graphql_client/custom_queries.py index 2e110fb..1559f68 100644 --- a/src/zepben/eas/lib/generated_graphql_client/custom_queries.py +++ b/src/zepben/eas/lib/generated_graphql_client/custom_queries.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional from .custom_fields import ( diff --git a/src/zepben/eas/lib/generated_graphql_client/custom_typing_fields.py b/src/zepben/eas/lib/generated_graphql_client/custom_typing_fields.py index 3cd62f6..e80403e 100644 --- a/src/zepben/eas/lib/generated_graphql_client/custom_typing_fields.py +++ b/src/zepben/eas/lib/generated_graphql_client/custom_typing_fields.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from .base_operation import GraphQLField diff --git a/src/zepben/eas/lib/generated_graphql_client/enums.py b/src/zepben/eas/lib/generated_graphql_client/enums.py index 7998246..218bd68 100644 --- a/src/zepben/eas/lib/generated_graphql_client/enums.py +++ b/src/zepben/eas/lib/generated_graphql_client/enums.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from enum import Enum diff --git a/src/zepben/eas/lib/generated_graphql_client/exceptions.py b/src/zepben/eas/lib/generated_graphql_client/exceptions.py index 5f05996..1c24482 100644 --- a/src/zepben/eas/lib/generated_graphql_client/exceptions.py +++ b/src/zepben/eas/lib/generated_graphql_client/exceptions.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional, Union import httpx diff --git a/src/zepben/eas/lib/generated_graphql_client/input_types.py b/src/zepben/eas/lib/generated_graphql_client/input_types.py index 915dbd9..cc17d1d 100644 --- a/src/zepben/eas/lib/generated_graphql_client/input_types.py +++ b/src/zepben/eas/lib/generated_graphql_client/input_types.py @@ -1,3 +1,10 @@ +# Copyright 2026 Zeppelin Bend Pty Ltd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + + from typing import Any, Optional from pydantic import Field From 7c0e3c1e2d4af3a2ae9fa918b59654d60adb07a9 Mon Sep 17 00:00:00 2001 From: Max Chesterfield Date: Thu, 2 Apr 2026 09:23:49 +1100 Subject: [PATCH 2/3] maybe its a version problem? Signed-off-by: Max Chesterfield --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index aa82659..97685b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ authors = [ ] dependencies = [ "geojson==2.5.0", - "httpx", + "httpx==0.28.1", "graphql-core==3.2.8", "pydantic", "pydantic_core", @@ -46,6 +46,7 @@ Homepage = "https://zepben.com" test = [ "pytest", "pytest-cov", + "pytest-asyncio", "pytest-httpserver==1.0.8", "trustme==0.9.0" ] From b62f2ec4ba2f122f06c9ab03bdef8be4bec9d0e2 Mon Sep 17 00:00:00 2001 From: Anthony Charlton Date: Thu, 2 Apr 2026 11:31:57 +1100 Subject: [PATCH 3/3] Added comment about lazy injection of licence as it is unlikely to change. Signed-off-by: Anthony Charlton --- src/zepben/eas/lib/ariadne_plugins/license_headers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zepben/eas/lib/ariadne_plugins/license_headers.py b/src/zepben/eas/lib/ariadne_plugins/license_headers.py index 671a4a8..c5bdc1e 100644 --- a/src/zepben/eas/lib/ariadne_plugins/license_headers.py +++ b/src/zepben/eas/lib/ariadne_plugins/license_headers.py @@ -10,6 +10,11 @@ now = datetime.now() +# +# NOTE: Being dodgy due to amount of time already spent. Ideally this would read and process the `.idea/copyright` files +# so we only need to update the licence in one place. Given this is unlikely to change, this can be done if we ever +# decide to change it in the future. +# license = f"""# Copyright {now.year} Zeppelin Bend Pty Ltd # # This Source Code Form is subject to the terms of the Mozilla Public