From 49d4834e0f72029f252d73e3f34c3df5da074d6c Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Thu, 17 Oct 2024 20:13:05 +0200 Subject: [PATCH] Remove exports from `infrahub_sdk.__init__.py` --- changelog/+8dff6891.removed.md | 1 + infrahub_sdk/__init__.py | 63 ---------------------------------- infrahub_sdk/ctl/generator.py | 2 +- tests/unit/sdk/test_schema.py | 4 +-- tests/unit/sdk/test_store.py | 3 +- 5 files changed, 6 insertions(+), 67 deletions(-) create mode 100644 changelog/+8dff6891.removed.md diff --git a/changelog/+8dff6891.removed.md b/changelog/+8dff6891.removed.md new file mode 100644 index 00000000..a34332fb --- /dev/null +++ b/changelog/+8dff6891.removed.md @@ -0,0 +1 @@ +Breaking change: Removed all exports from infrahub_sdk/__init__.py except InfrahubClient, InfrahubClientSync and Config. If you previously imported other classes such as InfrahubNode from the root level these need to change to instead be an absolute path. diff --git a/infrahub_sdk/__init__.py b/infrahub_sdk/__init__.py index 133f6c93..9892430a 100644 --- a/infrahub_sdk/__init__.py +++ b/infrahub_sdk/__init__.py @@ -2,76 +2,13 @@ import importlib.metadata -from .analyzer import GraphQLOperation, GraphQLQueryAnalyzer, GraphQLQueryVariable -from .batch import InfrahubBatch -from .branch import InfrahubBranchManager, InfrahubBranchManagerSync from .client import InfrahubClient, InfrahubClientSync from .config import Config -from .exceptions import ( - AuthenticationError, - Error, - GraphQLError, - NodeNotFoundError, - ServerNotReachableError, - ServerNotResponsiveError, - ValidationError, -) -from .graphql import Mutation, Query -from .node import InfrahubNode, InfrahubNodeSync -from .schema import ( - AttributeSchema, - GenericSchema, - InfrahubRepositoryConfig, - InfrahubSchema, - MainSchemaTypes, - NodeSchema, - ProfileSchema, - RelationshipCardinality, - RelationshipKind, - RelationshipSchema, - SchemaRoot, -) -from .store import NodeStore, NodeStoreSync -from .timestamp import Timestamp -from .uuidt import UUIDT, generate_uuid __all__ = [ - "AttributeSchema", - "AuthenticationError", "Config", - "Error", - "InfrahubBatch", - "InfrahubBranchManager", - "InfrahubBranchManagerSync", "InfrahubClient", "InfrahubClientSync", - "InfrahubNode", - "InfrahubNodeSync", - "InfrahubRepositoryConfig", - "InfrahubSchema", - "generate_uuid", - "GenericSchema", - "GraphQLQueryAnalyzer", - "GraphQLQueryVariable", - "GraphQLError", - "GraphQLOperation", - "MainSchemaTypes", - "NodeNotFoundError", - "NodeSchema", - "Mutation", - "NodeStore", - "NodeStoreSync", - "ProfileSchema", - "Query", - "RelationshipSchema", - "RelationshipCardinality", - "RelationshipKind", - "SchemaRoot", - "ServerNotReachableError", - "ServerNotResponsiveError", - "Timestamp", - "UUIDT", - "ValidationError", ] try: diff --git a/infrahub_sdk/ctl/generator.py b/infrahub_sdk/ctl/generator.py index fbb5659d..26fd6db0 100644 --- a/infrahub_sdk/ctl/generator.py +++ b/infrahub_sdk/ctl/generator.py @@ -3,11 +3,11 @@ from rich.console import Console -from .. import InfrahubNode from ..ctl import config from ..ctl.client import initialize_client from ..ctl.repository import get_repository_config from ..ctl.utils import execute_graphql_query, parse_cli_vars +from ..node import InfrahubNode from ..schema import InfrahubRepositoryConfig diff --git a/tests/unit/sdk/test_schema.py b/tests/unit/sdk/test_schema.py index dd571137..36be89ed 100644 --- a/tests/unit/sdk/test_schema.py +++ b/tests/unit/sdk/test_schema.py @@ -5,9 +5,9 @@ import pytest from rich.console import Console -from infrahub_sdk import Config, InfrahubClient, InfrahubClientSync, ValidationError +from infrahub_sdk import Config, InfrahubClient, InfrahubClientSync from infrahub_sdk.ctl.schema import display_schema_load_errors -from infrahub_sdk.exceptions import SchemaNotFoundError +from infrahub_sdk.exceptions import SchemaNotFoundError, ValidationError from infrahub_sdk.schema import ( InfrahubCheckDefinitionConfig, InfrahubJinja2TransformConfig, diff --git a/tests/unit/sdk/test_store.py b/tests/unit/sdk/test_store.py index ea298b39..3d02bb32 100644 --- a/tests/unit/sdk/test_store.py +++ b/tests/unit/sdk/test_store.py @@ -1,6 +1,7 @@ import pytest -from infrahub_sdk import InfrahubNode, NodeStore +from infrahub_sdk.node import InfrahubNode +from infrahub_sdk.store import NodeStore client_types = ["standard", "sync"]