nui-python-shared-utils 1.4.1__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/PKG-INFO +1 -1
  2. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_client.py +16 -3
  3. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_slack_client.py +46 -0
  4. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/.editorconfig +0 -0
  5. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/.github/workflows/ci.yml +0 -0
  6. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/.github/workflows/publish.yml +0 -0
  7. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/.github/workflows/test.yml +0 -0
  8. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/.markdownlint-cli2.yaml +0 -0
  9. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/AGENTS.md +0 -0
  10. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/CLAUDE.md +0 -0
  11. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/CONTRIBUTING.md +0 -0
  12. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/LICENSE +0 -0
  13. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/MANIFEST.in +0 -0
  14. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/README.md +0 -0
  15. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/README.md +0 -0
  16. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/development/testing.md +0 -0
  17. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/getting-started/configuration.md +0 -0
  18. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/getting-started/installation.md +0 -0
  19. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/getting-started/quickstart.md +0 -0
  20. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/cli-tools.md +0 -0
  21. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/elasticsearch-integration.md +0 -0
  22. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/jwt-authentication.md +0 -0
  23. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/lambda-utilities.md +0 -0
  24. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/llm-integration.md +0 -0
  25. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/log-processing.md +0 -0
  26. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/powertools-integration.md +0 -0
  27. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/shared-types.md +0 -0
  28. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/slack-integration.md +0 -0
  29. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/docs/guides/snowflake-integration.md +0 -0
  30. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/mypy.ini +0 -0
  31. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/__init__.py +0 -0
  32. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/base_client.py +0 -0
  33. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/cli.py +0 -0
  34. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/cloudwatch_metrics.py +0 -0
  35. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/config.py +0 -0
  36. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/db_client.py +0 -0
  37. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/error_handler.py +0 -0
  38. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/es_client.py +0 -0
  39. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/es_query_builder.py +0 -0
  40. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/jwt_auth.py +0 -0
  41. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/lambda_helpers.py +0 -0
  42. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/log_processors.py +0 -0
  43. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/powertools_helpers.py +0 -0
  44. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/secrets_helper.py +0 -0
  45. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_client.py +0 -0
  46. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_formatter.py +0 -0
  47. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_setup/__init__.py +0 -0
  48. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_setup/channel_creator.py +0 -0
  49. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_setup/channel_definitions.py +0 -0
  50. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/slack_setup/setup_helpers.py +0 -0
  51. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/snowflake_client.py +0 -0
  52. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/timezone.py +0 -0
  53. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_lambda_shared_utils/utils.py +0 -0
  54. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_python_shared_utils.egg-info/SOURCES.txt +0 -0
  55. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/__init__.py +0 -0
  56. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/base_client.py +0 -0
  57. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/cli.py +0 -0
  58. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/cloudwatch_metrics.py +0 -0
  59. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/config.py +0 -0
  60. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/db_client.py +0 -0
  61. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/error_handler.py +0 -0
  62. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/es_client.py +0 -0
  63. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/es_query_builder.py +0 -0
  64. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/jwt_auth.py +0 -0
  65. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/lambda_helpers.py +0 -0
  66. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/llm.py +0 -0
  67. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/log_processors.py +0 -0
  68. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/powertools_helpers.py +0 -0
  69. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/secrets_helper.py +0 -0
  70. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_formatter.py +0 -0
  71. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_setup/__init__.py +0 -0
  72. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_setup/channel_creator.py +0 -0
  73. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_setup/channel_definitions.py +0 -0
  74. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/slack_setup/setup_helpers.py +0 -0
  75. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/snowflake_client.py +0 -0
  76. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/timezone.py +0 -0
  77. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/nui_shared_utils/utils.py +0 -0
  78. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/pyproject.toml +0 -0
  79. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/pytest.ini +0 -0
  80. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/redirect/README.md +0 -0
  81. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/redirect/pyproject.toml +0 -0
  82. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/redirect/setup.py +0 -0
  83. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/requirements-test.txt +0 -0
  84. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/scripts/bench_imports.py +0 -0
  85. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/setup.cfg +0 -0
  86. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/setup.py +0 -0
  87. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/__init__.py +0 -0
  88. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_aws_utils.py +0 -0
  89. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_base_client.py +0 -0
  90. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_cloudwatch_metrics.py +0 -0
  91. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_config.py +0 -0
  92. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_db_client.py +0 -0
  93. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_error_handler.py +0 -0
  94. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_es_client.py +0 -0
  95. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_es_query_builder.py +0 -0
  96. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_jwt_auth.py +0 -0
  97. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_lambda_helpers.py +0 -0
  98. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_lazy_imports.py +0 -0
  99. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_llm.py +0 -0
  100. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_log_processors.py +0 -0
  101. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_powertools_helpers.py +0 -0
  102. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_secrets_helper.py +0 -0
  103. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_slack_formatter.py +0 -0
  104. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_snowflake_client.py +0 -0
  105. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_timezone.py +0 -0
  106. {nui_python_shared_utils-1.4.1 → nui_python_shared_utils-1.5.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nui-python-shared-utils
3
- Version: 1.4.1
3
+ Version: 1.5.0
4
4
  Summary: Shared Python utilities for AWS Lambda, CLI tools, and agents with Slack, Elasticsearch, and monitoring integrations
5
5
  Home-page: https://github.com/nuimarkets/nui-python-shared-utils
6
6
  Author: NUI Markets
@@ -388,7 +388,9 @@ class SlackClient(BaseClient, ServiceHealthMixin):
388
388
  blocks: Optional[List[Dict]] = None,
389
389
  attachments: Optional[List[Dict]] = None,
390
390
  include_lambda_header: bool = True,
391
- event_type: Optional[str] = None
391
+ event_type: Optional[str] = None,
392
+ unfurl_links: Optional[bool] = None,
393
+ unfurl_media: Optional[bool] = None,
392
394
  ) -> bool:
393
395
  """
394
396
  Send message to Slack channel with standardized error handling.
@@ -400,6 +402,10 @@ class SlackClient(BaseClient, ServiceHealthMixin):
400
402
  attachments: Legacy attachment objects (supports color sidebars)
401
403
  include_lambda_header: Whether to include context header
402
404
  event_type: Optional event type label for header (e.g., "Scheduled", "API", "SQS")
405
+ unfurl_links: Override Slack link unfurling. None leaves Slack's default;
406
+ False suppresses link preview cards (links stay clickable)
407
+ unfurl_media: Override Slack media unfurling. None leaves Slack's default;
408
+ False suppresses media preview cards
403
409
 
404
410
  Returns:
405
411
  True if successful, False otherwise
@@ -419,12 +425,19 @@ class SlackClient(BaseClient, ServiceHealthMixin):
419
425
  else:
420
426
  blocks_with_header = blocks
421
427
 
422
- response = self._service_client.chat_postMessage(
428
+ kwargs = dict(
423
429
  channel=channel,
424
430
  text=text,
425
431
  blocks=blocks_with_header,
426
- attachments=attachments
432
+ attachments=attachments,
427
433
  )
434
+ # Forward unfurl controls only when explicitly set, so existing callers
435
+ # keep Slack's default behavior (and their call assertions stay unchanged).
436
+ if unfurl_links is not None:
437
+ kwargs["unfurl_links"] = unfurl_links
438
+ if unfurl_media is not None:
439
+ kwargs["unfurl_media"] = unfurl_media
440
+ response = self._service_client.chat_postMessage(**kwargs)
428
441
 
429
442
  if response["ok"]:
430
443
  log.info(
@@ -111,6 +111,52 @@ class TestSendMessage:
111
111
  channel="C123", text="Fallback", blocks=None, attachments=attachments
112
112
  )
113
113
 
114
+ @patch("nui_shared_utils.base_client.get_secret")
115
+ @patch("nui_shared_utils.slack_client.WebClient")
116
+ def test_send_message_forwards_unfurl_flags(self, mock_webclient, mock_get_secret):
117
+ """unfurl_links / unfurl_media are forwarded to chat_postMessage when set."""
118
+ mock_get_secret.return_value = {"bot_token": "xoxb-test-token"}
119
+ mock_client = Mock()
120
+ mock_webclient.return_value = mock_client
121
+ mock_client.chat_postMessage.return_value = {"ok": True, "ts": "1234567890.123456"}
122
+
123
+ slack = SlackClient(secret_name="test-secret")
124
+ result = slack.send_message(
125
+ "C123",
126
+ "Test message",
127
+ include_lambda_header=False,
128
+ unfurl_links=False,
129
+ unfurl_media=False,
130
+ )
131
+
132
+ assert result is True
133
+ mock_client.chat_postMessage.assert_called_once_with(
134
+ channel="C123",
135
+ text="Test message",
136
+ blocks=None,
137
+ attachments=None,
138
+ unfurl_links=False,
139
+ unfurl_media=False,
140
+ )
141
+
142
+ @patch("nui_shared_utils.base_client.get_secret")
143
+ @patch("nui_shared_utils.slack_client.WebClient")
144
+ def test_send_message_omits_unfurl_when_unset(self, mock_webclient, mock_get_secret):
145
+ """When the unfurl flags are unset (default None), they are NOT forwarded, so
146
+ Slack's default behavior is preserved for every existing caller."""
147
+ mock_get_secret.return_value = {"bot_token": "xoxb-test-token"}
148
+ mock_client = Mock()
149
+ mock_webclient.return_value = mock_client
150
+ mock_client.chat_postMessage.return_value = {"ok": True, "ts": "1234567890.123456"}
151
+
152
+ slack = SlackClient(secret_name="test-secret")
153
+ result = slack.send_message("C123", "Test message", include_lambda_header=False)
154
+
155
+ assert result is True
156
+ _, kwargs = mock_client.chat_postMessage.call_args
157
+ assert "unfurl_links" not in kwargs
158
+ assert "unfurl_media" not in kwargs
159
+
114
160
  @patch("nui_shared_utils.base_client.get_secret")
115
161
  @patch("nui_shared_utils.slack_client.WebClient")
116
162
  def test_send_message_api_error(self, mock_webclient, mock_get_secret):