cwyodmodules 0.3.52__tar.gz → 0.3.54__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 (124) hide show
  1. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/PKG-INFO +2 -2
  2. cwyodmodules-0.3.54/cwyodmodules/__init__.py +1 -0
  3. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/layout.py +1 -0
  4. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules.egg-info/PKG-INFO +2 -2
  5. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules.egg-info/SOURCES.txt +0 -1
  6. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules.egg-info/requires.txt +1 -1
  7. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/pyproject.toml +2 -2
  8. cwyodmodules-0.3.52/cwyodmodules/graphrag/query/__init__.py +0 -0
  9. cwyodmodules-0.3.52/cwyodmodules/mgmt_config.py +0 -197
  10. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/LICENSE +0 -0
  11. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/README.md +0 -0
  12. {cwyodmodules-0.3.52/cwyodmodules → cwyodmodules-0.3.54/cwyodmodules/api}/__init__.py +0 -0
  13. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/api/chat_history.py +0 -0
  14. {cwyodmodules-0.3.52/cwyodmodules/api → cwyodmodules-0.3.54/cwyodmodules/batch}/__init__.py +0 -0
  15. {cwyodmodules-0.3.52/cwyodmodules/batch → cwyodmodules-0.3.54/cwyodmodules/batch/utilities}/__init__.py +0 -0
  16. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/auth_utils.py +0 -0
  17. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/cosmosdb.py +0 -0
  18. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/database_client_base.py +0 -0
  19. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/database_factory.py +0 -0
  20. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/postgresdbservice.py +0 -0
  21. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/chat_history/sample_user.py +0 -0
  22. {cwyodmodules-0.3.52/cwyodmodules/batch/utilities → cwyodmodules-0.3.54/cwyodmodules/batch/utilities/common}/__init__.py +0 -0
  23. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/common/answer.py +0 -0
  24. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/common/source_document.py +0 -0
  25. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/__init__.py +0 -0
  26. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/chunking_strategy.py +0 -0
  27. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/document_chunking_base.py +0 -0
  28. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/fixed_size_overlap.py +0 -0
  29. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/page.py +0 -0
  30. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/paragraph.py +0 -0
  31. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_chunking/strategies.py +0 -0
  32. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/__init__.py +0 -0
  33. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/document_loading_base.py +0 -0
  34. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/layout.py +0 -0
  35. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/read.py +0 -0
  36. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/strategies.py +0 -0
  37. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/web.py +0 -0
  38. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/document_loading/word_document.py +0 -0
  39. {cwyodmodules-0.3.52/cwyodmodules/batch/utilities/common → cwyodmodules-0.3.54/cwyodmodules/batch/utilities/helpers}/__init__.py +0 -0
  40. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_blob_storage_client.py +0 -0
  41. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_computer_vision_client.py +0 -0
  42. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_form_recognizer_helper.py +0 -0
  43. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper.py +0 -0
  44. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper_light_rag.py +0 -0
  45. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/azure_search_helper.py +0 -0
  46. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/agent_mode.py +0 -0
  47. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/assistant_strategy.py +0 -0
  48. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/config_helper.py +0 -0
  49. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/conversation_flow.py +0 -0
  50. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/database_type.py +0 -0
  51. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/default.json +0 -0
  52. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/default_contract_assistant_prompt.txt +0 -0
  53. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/default_employee_assistant_prompt.txt +0 -0
  54. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/config/embedding_config.py +0 -0
  55. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/document_chunking_helper.py +0 -0
  56. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/document_loading_helper.py +0 -0
  57. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/embedders/embedder_base.py +0 -0
  58. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/embedders/embedder_factory.py +0 -0
  59. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py +0 -0
  60. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/embedders/postgres_embedder.py +0 -0
  61. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/embedders/push_embedder.py +0 -0
  62. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/env_helper.py +0 -0
  63. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/lightrag_helper.py +0 -0
  64. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/llm_helper.py +0 -0
  65. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/helpers/orchestrator_helper.py +0 -0
  66. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_datasource.py +0 -0
  67. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_index.py +0 -0
  68. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_indexer.py +0 -0
  69. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_skillset.py +0 -0
  70. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/loggers/conversation_logger.py +0 -0
  71. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/__init__.py +0 -0
  72. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/lang_chain_agent.py +0 -0
  73. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/open_ai_functions.py +0 -0
  74. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/orchestration_strategy.py +0 -0
  75. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/orchestrator_base.py +0 -0
  76. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/prompt_flow.py +0 -0
  77. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/semantic_kernel_orchestrator.py +0 -0
  78. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/orchestrator/strategies.py +0 -0
  79. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/parser/__init__.py +0 -0
  80. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/parser/output_parser_tool.py +0 -0
  81. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/parser/parser_base.py +0 -0
  82. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/plugins/chat_plugin.py +0 -0
  83. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py +0 -0
  84. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/plugins/post_answering_plugin.py +0 -0
  85. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/azure_search_handler.py +0 -0
  86. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/azure_search_handler_light_rag.py +0 -0
  87. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/integrated_vectorization_search_handler.py +0 -0
  88. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/lightrag_search_handler.py +0 -0
  89. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/postgres_search_handler.py +0 -0
  90. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/postgres_search_handler_light_rag.py +0 -0
  91. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/search.py +0 -0
  92. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/search/search_handler_base.py +0 -0
  93. {cwyodmodules-0.3.52/cwyodmodules/batch/utilities/helpers → cwyodmodules-0.3.54/cwyodmodules/batch/utilities/tools}/__init__.py +0 -0
  94. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/answer_processing_base.py +0 -0
  95. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/answering_tool_base.py +0 -0
  96. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/content_safety_checker.py +0 -0
  97. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/post_prompt_tool.py +0 -0
  98. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/question_answer_tool.py +0 -0
  99. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/batch/utilities/tools/text_processing_tool.py +0 -0
  100. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/__init__.py +0 -0
  101. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/config.py +0 -0
  102. {cwyodmodules-0.3.52/cwyodmodules/batch/utilities/tools → cwyodmodules-0.3.54/cwyodmodules/graphrag/database}/__init__.py +0 -0
  103. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/database/base.py +0 -0
  104. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/database/models.py +0 -0
  105. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/__init__.py +0 -0
  106. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/chunking.py +0 -0
  107. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/extraction.py +0 -0
  108. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/types.py +0 -0
  109. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/upsert.py +0 -0
  110. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/indexing/utils.py +0 -0
  111. {cwyodmodules-0.3.52/cwyodmodules/graphrag/database → cwyodmodules-0.3.54/cwyodmodules/graphrag/llm}/__init__.py +0 -0
  112. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/llm/llm.py +0 -0
  113. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/llm/prompt.py +0 -0
  114. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/main.py +0 -0
  115. {cwyodmodules-0.3.52/cwyodmodules/graphrag/llm → cwyodmodules-0.3.54/cwyodmodules/graphrag/query}/__init__.py +0 -0
  116. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/query/generate.py +0 -0
  117. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/query/graph_search.py +0 -0
  118. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/query/types.py +0 -0
  119. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules/graphrag/query/vector_search.py +0 -0
  120. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules.egg-info/dependency_links.txt +0 -0
  121. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/cwyodmodules.egg-info/top_level.txt +0 -0
  122. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/setup.cfg +0 -0
  123. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/tests/test_api.py +0 -0
  124. {cwyodmodules-0.3.52 → cwyodmodules-0.3.54}/tests/test_batch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.52
3
+ Version: 0.3.54
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -40,7 +40,7 @@ Requires-Dist: azure-search-documents==11.6.0b4
40
40
  Requires-Dist: semantic-kernel==1.3.0
41
41
  Requires-Dist: pydantic==2.7.4
42
42
  Requires-Dist: pandas>=2.2.3
43
- Requires-Dist: azpaddypy>=0.3.7
43
+ Requires-Dist: azpaddypy>=0.4.0
44
44
  Dynamic: license-file
45
45
 
46
46
  # paddypy
@@ -4,6 +4,7 @@ from langchain.text_splitter import MarkdownTextSplitter
4
4
  from .chunking_strategy import ChunkingSettings
5
5
  from ..common.source_document import SourceDocument
6
6
  from ...utilities.helpers.env_helper import EnvHelper
7
+
7
8
  from mgmt_config import logger
8
9
  env_helper: EnvHelper = EnvHelper()
9
10
  log_execution = env_helper.LOG_EXECUTION
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.52
3
+ Version: 0.3.54
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -40,7 +40,7 @@ Requires-Dist: azure-search-documents==11.6.0b4
40
40
  Requires-Dist: semantic-kernel==1.3.0
41
41
  Requires-Dist: pydantic==2.7.4
42
42
  Requires-Dist: pandas>=2.2.3
43
- Requires-Dist: azpaddypy>=0.3.7
43
+ Requires-Dist: azpaddypy>=0.4.0
44
44
  Dynamic: license-file
45
45
 
46
46
  # paddypy
@@ -2,7 +2,6 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  cwyodmodules/__init__.py
5
- cwyodmodules/mgmt_config.py
6
5
  cwyodmodules.egg-info/PKG-INFO
7
6
  cwyodmodules.egg-info/SOURCES.txt
8
7
  cwyodmodules.egg-info/dependency_links.txt
@@ -31,4 +31,4 @@ azure-search-documents==11.6.0b4
31
31
  semantic-kernel==1.3.0
32
32
  pydantic==2.7.4
33
33
  pandas>=2.2.3
34
- azpaddypy>=0.3.7
34
+ azpaddypy>=0.4.0
@@ -3,7 +3,7 @@ name = "cwyodmodules"
3
3
  authors = [
4
4
  { name="Patrik", email="patrikhartl@gmail.com" },
5
5
  ]
6
- version = '0.3.52'
6
+ version = '0.3.54'
7
7
  description = "Add your description here"
8
8
  readme = "README.md"
9
9
  requires-python = "==3.11.11"
@@ -44,7 +44,7 @@ dependencies = [
44
44
  "semantic-kernel==1.3.0",
45
45
  "pydantic==2.7.4",
46
46
  "pandas>=2.2.3",
47
- "azpaddypy>=0.3.7",
47
+ "azpaddypy>=0.4.0",
48
48
  ]
49
49
 
50
50
  [tool.uv]
@@ -1,197 +0,0 @@
1
- """
2
- Azure Project Management Configuration Template
3
-
4
- This template provides standardized configuration for Azure logging and identity
5
- management across projects. It creates singleton instances of AzureLogger and
6
- AzureIdentity that can be imported and used throughout your application.
7
-
8
- Usage:
9
- from mgmt_config import logger, identity
10
-
11
- logger.info("Application started")
12
- credential = identity.get_credential()
13
- """
14
-
15
- import os
16
- from typing import Optional, Dict, Any
17
- from azpaddypy.mgmt.logging import create_app_logger, create_function_logger
18
- from azpaddypy.mgmt.identity import create_azure_identity
19
- from azpaddypy.resources.keyvault import create_azure_keyvault
20
-
21
- # Alias for import in other packages
22
-
23
- # =============================================================================
24
- # SERVICE CONFIGURATION
25
- # =============================================================================
26
-
27
- # Service identity - customize these for your project
28
- SERVICE_NAME = os.getenv("REFLECTION_KIND", "cwyodmodules-pacakge")
29
- SERVICE_VERSION = os.getenv("SERVICE_VERSION", "1.0.0")
30
-
31
- # =============================================================================
32
- # LOGGING CONFIGURATION
33
- # =============================================================================
34
-
35
- # Enable console output (useful for local development)
36
- LOGGER_ENABLE_CONSOLE = os.getenv("LOGGER_ENABLE_CONSOLE", "true").lower() == "true"
37
-
38
- # Application Insights connection string (optional, will use environment variable if not set)
39
- LOGGER_CONNECTION_STRING = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING")
40
-
41
- # Configure which Azure SDK components to instrument
42
- LOGGER_INSTRUMENTATION_OPTIONS = {
43
- "azure_sdk": {"enabled": True},
44
- "django": {"enabled": False},
45
- "fastapi": {"enabled": False},
46
- "flask": {"enabled": True},
47
- "psycopg2": {"enabled": True},
48
- "requests": {"enabled": True},
49
- "urllib": {"enabled": True},
50
- "urllib3": {"enabled": True},
51
- }
52
-
53
- # =============================================================================
54
- # IDENTITY CONFIGURATION
55
- # =============================================================================
56
-
57
- # Token caching settings
58
- IDENTITY_ENABLE_TOKEN_CACHE = os.getenv("IDENTITY_ENABLE_TOKEN_CACHE", "true").lower() == "true"
59
- IDENTITY_ALLOW_UNENCRYPTED_STORAGE = os.getenv("IDENTITY_ALLOW_UNENCRYPTED_STORAGE", "true").lower() == "true"
60
-
61
- # Custom credential options (None means use defaults)
62
- IDENTITY_CUSTOM_CREDENTIAL_OPTIONS: Optional[Dict[str, Any]] = None
63
-
64
- # Connection string for identity logging (uses same as logger by default)
65
- IDENTITY_CONNECTION_STRING = LOGGER_CONNECTION_STRING
66
-
67
- # =============================================================================
68
- # KEYVAULT CONFIGURATION
69
- # =============================================================================
70
-
71
- # Azure Key Vault URL (required for Key Vault operations)
72
- KEYVAULT_URL = os.getenv("key_vault_uri")
73
- HEAD_KEYVAULT_URL = os.getenv("head_key_vault_uri")
74
-
75
- # Enable specific Key Vault client types
76
- KEYVAULT_ENABLE_SECRETS = os.getenv("KEYVAULT_ENABLE_SECRETS", "true").lower() == "true"
77
- KEYVAULT_ENABLE_KEYS = os.getenv("KEYVAULT_ENABLE_KEYS", "false").lower() == "true"
78
- KEYVAULT_ENABLE_CERTIFICATES = os.getenv("KEYVAULT_ENABLE_CERTIFICATES", "false").lower() == "true"
79
-
80
- # Connection string for keyvault logging (uses same as logger by default)
81
- KEYVAULT_CONNECTION_STRING = LOGGER_CONNECTION_STRING
82
-
83
- # =============================================================================
84
- # INITIALIZE SERVICES
85
- # =============================================================================
86
- # Create logger instance
87
- if "functionapp" in os.getenv("REFLECTION_KIND", "app"):
88
- logger = create_function_logger(
89
- function_app_name=SERVICE_NAME,
90
- function_name="backend",
91
- service_version=SERVICE_VERSION,
92
- connection_string=LOGGER_CONNECTION_STRING,
93
- instrumentation_options=LOGGER_INSTRUMENTATION_OPTIONS,
94
- )
95
- logger.info("Function logger initialized")
96
- else:
97
- logger = create_app_logger(
98
- service_name=SERVICE_NAME,
99
- service_version=SERVICE_VERSION,
100
- connection_string=LOGGER_CONNECTION_STRING,
101
- enable_console_logging=LOGGER_ENABLE_CONSOLE,
102
- instrumentation_options=LOGGER_INSTRUMENTATION_OPTIONS,
103
- )
104
- logger.info("App logger initialized")
105
-
106
- # Create identity instance with shared logger
107
- identity = create_azure_identity(
108
- service_name=SERVICE_NAME,
109
- service_version=SERVICE_VERSION,
110
- enable_token_cache=IDENTITY_ENABLE_TOKEN_CACHE,
111
- allow_unencrypted_storage=IDENTITY_ALLOW_UNENCRYPTED_STORAGE,
112
- custom_credential_options=IDENTITY_CUSTOM_CREDENTIAL_OPTIONS,
113
- connection_string=IDENTITY_CONNECTION_STRING,
114
- logger=logger,
115
- )
116
-
117
- # Create keyvault instance with shared logger and identity (if URL is configured)
118
- keyvault = None
119
- if KEYVAULT_URL:
120
- keyvault = create_azure_keyvault(
121
- vault_url=KEYVAULT_URL,
122
- azure_identity=identity,
123
- service_name=SERVICE_NAME,
124
- service_version=SERVICE_VERSION,
125
- logger=logger,
126
- connection_string=KEYVAULT_CONNECTION_STRING,
127
- enable_secrets=KEYVAULT_ENABLE_SECRETS,
128
- enable_keys=KEYVAULT_ENABLE_KEYS,
129
- enable_certificates=KEYVAULT_ENABLE_CERTIFICATES,
130
- )
131
-
132
- head_keyvault = None
133
- if HEAD_KEYVAULT_URL:
134
- head_keyvault = create_azure_keyvault(
135
- vault_url=HEAD_KEYVAULT_URL,
136
- azure_identity=identity,
137
- service_name=SERVICE_NAME,
138
- service_version=SERVICE_VERSION,
139
- logger=logger,
140
- connection_string=KEYVAULT_CONNECTION_STRING,
141
- enable_secrets=KEYVAULT_ENABLE_SECRETS,
142
- enable_keys=KEYVAULT_ENABLE_KEYS,
143
- enable_certificates=KEYVAULT_ENABLE_CERTIFICATES,
144
- )
145
-
146
- # =============================================================================
147
- # VALIDATION & STARTUP
148
- # =============================================================================
149
-
150
- # Validate critical configuration
151
- if SERVICE_NAME == __name__:
152
- logger.warning(
153
- "SERVICE_NAME is not configured. Please set SERVICE_NAME environment variable or update this template.",
154
- extra={"configuration_issue": "service_name_not_set"}
155
- )
156
-
157
- if not LOGGER_CONNECTION_STRING:
158
- logger.info(
159
- "No Application Insights connection string configured. Telemetry will be disabled.",
160
- extra={"telemetry_status": "disabled"}
161
- )
162
-
163
- if not KEYVAULT_URL:
164
- logger.info(
165
- "No Key Vault URL configured. Key Vault operations will be disabled.",
166
- extra={"keyvault_status": "disabled"}
167
- )
168
-
169
- if not HEAD_KEYVAULT_URL:
170
- logger.info(
171
- "No Head Key Vault URL configured. Head Key Vault operations will be disabled.",
172
- extra={"head_keyvault_status": "disabled"}
173
- )
174
-
175
- # Log successful initialization
176
- logger.info(
177
- f"Management configuration initialized for service '{SERVICE_NAME}' v{SERVICE_VERSION}",
178
- extra={
179
- "service_name": SERVICE_NAME,
180
- "service_version": SERVICE_VERSION,
181
- "console_logging": LOGGER_ENABLE_CONSOLE,
182
- "token_cache_enabled": IDENTITY_ENABLE_TOKEN_CACHE,
183
- "telemetry_enabled": bool(LOGGER_CONNECTION_STRING),
184
- "keyvault_enabled": bool(KEYVAULT_URL),
185
- "head_keyvault_enabled": bool(HEAD_KEYVAULT_URL),
186
- "keyvault_secrets_enabled": KEYVAULT_ENABLE_SECRETS if KEYVAULT_URL else False,
187
- "keyvault_keys_enabled": KEYVAULT_ENABLE_KEYS if KEYVAULT_URL else False,
188
- "keyvault_certificates_enabled": KEYVAULT_ENABLE_CERTIFICATES if KEYVAULT_URL else False,
189
- }
190
- )
191
-
192
- # =============================================================================
193
- # EXPORTS
194
- # =============================================================================
195
-
196
- # Export logger, identity, and keyvault for use in applications
197
- __all__ = ["logger", "identity", "keyvault", "head_keyvault"]
File without changes
File without changes
File without changes