Skip to content
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
4 changes: 3 additions & 1 deletion nisystemlink/clients/alarm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with AlarmClient for alarm management."""

from nisystemlink.clients.alarm._alarm_client import AlarmClient

# flake8: noqa
__all__ = ["AlarmClient"]
Comment thread
fredvisser marked this conversation as resolved.
8 changes: 5 additions & 3 deletions nisystemlink/clients/artifact/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from ._artifact_client import ArtifactClient

# flake8: noqa
"""Start here with ArtifactClient for artifact management."""

from ._artifact_client import ArtifactClient

__all__ = ["ArtifactClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/assetmanagement/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Start here with AssetManagementClient for asset management."""

from nisystemlink.clients.assetmanagement._asset_management_client import (
AssetManagementClient,
)

# flake8: noqa
__all__ = ["AssetManagementClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/dataframe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with DataFrameClient for dataframe operations."""

from ._data_frame_client import DataFrameClient

# flake8: noqa
__all__ = ["DataFrameClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/feeds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with FeedsClient for feed management."""

from ._feeds_client import FeedsClient

# flake8: noqa
__all__ = ["FeedsClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/file/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with FileClient for file operations."""

from ._file_client import FileClient

# flake8: noqa
__all__ = ["FileClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/notebook/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with NotebookClient for notebook management."""

from ._notebook_client import NotebookClient

# flake8: noqa
__all__ = ["NotebookClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/notification/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with NotificationClient for notification management."""

from ._notification_client import NotificationClient

# flake8: noqa
__all__ = ["NotificationClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/product/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with ProductClient for product management."""

from ._product_client import ProductClient

# flake8: noqa
__all__ = ["ProductClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/spec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with SpecClient for specification management."""

from ._spec_client import SpecClient

# flake8: noqa
__all__ = ["SpecClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/systems/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with SystemsClient for system management."""

from nisystemlink.clients.systems._systems_client import SystemsClient

# flake8: noqa
__all__ = ["SystemsClient"]
38 changes: 30 additions & 8 deletions nisystemlink/clients/tag/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
# -*- coding: utf-8 -*-

"""Start here with TagManager for tag operations and helper types."""

from ._data_type import DataType
from ._retention_type import RetentionType
from ._tag_data import TagData
from ._tag_with_aggregates import TagWithAggregates
from ._async_tag_query_result_collection import AsyncTagQueryResultCollection
from ._tag_with_aggregates import TagWithAggregates # noqa: I100
from ._async_tag_query_result_collection import ( # noqa: I100
AsyncTagQueryResultCollection,
)
from ._itag_reader import ITagReader
from ._itag_writer import ITagWriter
from ._buffered_tag_writer import BufferedTagWriter
from ._buffered_tag_writer import BufferedTagWriter # noqa: I100
from ._tag_value_reader import TagValueReader
from ._tag_value_writer import TagValueWriter
from ._tag_update_fields import TagUpdateFields
from ._tag_data_update import TagDataUpdate
from ._tag_update_fields import TagUpdateFields # noqa: I100
from ._tag_data_update import TagDataUpdate # noqa: I100
from ._tag_path_utilities import TagPathUtilities
from ._tag_query_result_collection import TagQueryResultCollection
from ._tag_subscription import TagSubscription
from ._tag_selection import TagSelection
from ._tag_manager import TagManager
from ._tag_selection import TagSelection # noqa: I100
from ._tag_manager import TagManager # noqa: I100

# flake8: noqa
__all__ = [
"DataType",
"RetentionType",
"TagData",
"TagWithAggregates",
"AsyncTagQueryResultCollection",
"ITagReader",
"ITagWriter",
"BufferedTagWriter",
"TagValueReader",
"TagValueWriter",
"TagUpdateFields",
"TagDataUpdate",
"TagPathUtilities",
"TagQueryResultCollection",
"TagSubscription",
"TagSelection",
"TagManager",
]
4 changes: 3 additions & 1 deletion nisystemlink/clients/test_plan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with TestPlanClient for test plan management."""

from ._test_plan_client import TestPlanClient

# flake8: noqa
__all__ = ["TestPlanClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/testmonitor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with TestMonitorClient for test monitor operations."""

from ._test_monitor_client import TestMonitorClient

# flake8: noqa
__all__ = ["TestMonitorClient"]
4 changes: 3 additions & 1 deletion nisystemlink/clients/work_item/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Start here with WorkItemClient for work item operations."""

from ._work_item_client import WorkItemClient, WorkItemExecuteApiException

# flake8: noqa
__all__ = ["WorkItemClient", "WorkItemExecuteApiException"]
73 changes: 73 additions & 0 deletions tests/test_service_package_exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Validate the public surface declared by each service package."""

import ast
import unittest
from pathlib import Path

PACKAGE_EXPORTS = {
"alarm": ["AlarmClient"],
"artifact": ["ArtifactClient"],
"assetmanagement": ["AssetManagementClient"],
"dataframe": ["DataFrameClient"],
"feeds": ["FeedsClient"],
"file": ["FileClient"],
"notebook": ["NotebookClient"],
"notification": ["NotificationClient"],
"product": ["ProductClient"],
"spec": ["SpecClient"],
"systems": ["SystemsClient"],
"tag": [
"DataType",
"RetentionType",
"TagData",
"TagWithAggregates",
"AsyncTagQueryResultCollection",
"ITagReader",
"ITagWriter",
"BufferedTagWriter",
"TagValueReader",
"TagValueWriter",
"TagUpdateFields",
"TagDataUpdate",
"TagPathUtilities",
"TagQueryResultCollection",
"TagSubscription",
"TagSelection",
"TagManager",
],
"test_plan": ["TestPlanClient"],
"testmonitor": ["TestMonitorClient"],
"work_item": ["WorkItemClient", "WorkItemExecuteApiException"],
}


class TestServicePackageExports(unittest.TestCase):
"""Verify service package docstrings and explicit export lists."""

def test_service_package_exports_are_explicit(self):
"""Each service package should document and declare its public exports."""
package_root = Path(__file__).resolve().parents[1] / "nisystemlink" / "clients"

for package_name, exported_names in PACKAGE_EXPORTS.items():
with self.subTest(package_name=package_name):
module_path = package_root / package_name / "__init__.py"
module = ast.parse(module_path.read_text(encoding="utf-8"))
imported_names = []
declared_exports = None
module_docstring = ast.get_docstring(module)

self.assertIsNotNone(module_docstring)
if module_docstring is None:
self.fail(f"Missing module docstring in {module_path}")
self.assertTrue(module_docstring.startswith("Start here with "))
Comment thread
fredvisser marked this conversation as resolved.

for node in module.body:
if isinstance(node, ast.ImportFrom):
imported_names.extend(alias.name for alias in node.names)
elif isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "__all__":
declared_exports = ast.literal_eval(node.value)

self.assertEqual(declared_exports, exported_names)
self.assertCountEqual(imported_names, exported_names)
Loading