sycommon-python-lib 0.1.59__tar.gz → 0.2.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 (178) hide show
  1. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/PKG-INFO +21 -15
  2. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/pyproject.toml +21 -15
  3. sycommon_python_lib-0.2.0/src/command/__init__.py +28 -0
  4. sycommon_python_lib-0.2.0/src/command/cli.py +309 -0
  5. sycommon_python_lib-0.2.0/src/command/core/__init__.py +19 -0
  6. sycommon_python_lib-0.2.0/src/command/core/console.py +36 -0
  7. sycommon_python_lib-0.2.0/src/command/core/models.py +47 -0
  8. sycommon_python_lib-0.2.0/src/command/core/project.py +238 -0
  9. sycommon_python_lib-0.2.0/src/command/core/utils.py +31 -0
  10. sycommon_python_lib-0.2.0/src/command/templates/__init__.py +1 -0
  11. sycommon_python_lib-0.2.0/src/command/templates/agent/__init__.py +1 -0
  12. sycommon_python_lib-0.2.0/src/command/templates/base/__init__.py +1 -0
  13. sycommon_python_lib-0.2.0/src/command/templates/web/__init__.py +1 -0
  14. sycommon_python_lib-0.2.0/src/sycommon/agent/__init__.py +38 -0
  15. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/01_basic_agent.py +134 -0
  16. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/02_tool_agent.py +306 -0
  17. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/03_structured_output.py +326 -0
  18. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/04_memory_agent.py +349 -0
  19. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/05_streaming.py +332 -0
  20. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/06_multi_agent.py +460 -0
  21. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/07_skills_agent.py +436 -0
  22. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/08_middleware.py +295 -0
  23. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/09_interrupt.py +465 -0
  24. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/10_custom_llm.py +377 -0
  25. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/11_complex_workflow.py +502 -0
  26. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/12_batch_processing.py +457 -0
  27. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/__init__.py +44 -0
  28. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/01_basic_monitoring.py +492 -0
  29. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/02_permission_control.py +740 -0
  30. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/03_tool_skill_filter.py +806 -0
  31. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/04_caching_retry.py +728 -0
  32. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/05_sanitization.py +721 -0
  33. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/06_tracking.py +649 -0
  34. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/07_advanced.py +814 -0
  35. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/08_progressive_skills.py +930 -0
  36. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/__init__.py +40 -0
  37. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/middleware/override_examples.py +547 -0
  38. sycommon_python_lib-0.2.0/src/sycommon/agent/examples/virtual_employee_demo.py +463 -0
  39. sycommon_python_lib-0.2.0/src/sycommon/agent/exports.py +107 -0
  40. sycommon_python_lib-0.2.0/src/sycommon/agent/get_agent.py +205 -0
  41. sycommon_python_lib-0.2.0/src/sycommon/agent/skills/__init__.py +18 -0
  42. sycommon_python_lib-0.2.0/src/sycommon/agent/skills/examples/faq_handler/scripts/search.py +68 -0
  43. sycommon_python_lib-0.2.0/src/sycommon/agent/skills/exports.py +78 -0
  44. sycommon_python_lib-0.2.0/src/sycommon/agent/virtual_employee.py +774 -0
  45. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/Config.py +51 -0
  46. sycommon_python_lib-0.2.0/src/sycommon/config/ElasticsearchConfig.py +65 -0
  47. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/LLMConfig.py +2 -0
  48. sycommon_python_lib-0.2.0/src/sycommon/config/RedisConfig.py +150 -0
  49. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/database/async_database_service.py +4 -2
  50. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/database/database_service.py +5 -3
  51. sycommon_python_lib-0.2.0/src/sycommon/database/elasticsearch_service.py +104 -0
  52. sycommon_python_lib-0.2.0/src/sycommon/database/redis_service.py +767 -0
  53. sycommon_python_lib-0.2.0/src/sycommon/database/token_usage_db_service.py +180 -0
  54. sycommon_python_lib-0.2.0/src/sycommon/heartbeat_process/__init__.py +67 -0
  55. sycommon_python_lib-0.2.0/src/sycommon/heartbeat_process/heartbeat_config.py +137 -0
  56. sycommon_python_lib-0.2.0/src/sycommon/heartbeat_process/heartbeat_process_manager.py +299 -0
  57. sycommon_python_lib-0.2.0/src/sycommon/heartbeat_process/heartbeat_process_worker.py +466 -0
  58. sycommon_python_lib-0.2.0/src/sycommon/llm/embedding.py +458 -0
  59. sycommon_python_lib-0.2.0/src/sycommon/llm/get_llm.py +176 -0
  60. sycommon_python_lib-0.2.0/src/sycommon/llm/llm_logger.py +77 -0
  61. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/llm/llm_tokens.py +1 -1
  62. sycommon_python_lib-0.2.0/src/sycommon/llm/llm_with_token_tracking.py +217 -0
  63. sycommon_python_lib-0.2.0/src/sycommon/llm/native_with_fallback_runnable.py +201 -0
  64. sycommon_python_lib-0.2.0/src/sycommon/llm/output_fixing_runnable.py +216 -0
  65. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/llm/struct_token.py +227 -42
  66. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/llm/sy_langfuse.py +1 -3
  67. sycommon_python_lib-0.2.0/src/sycommon/llm/token_usage_es_service.py +539 -0
  68. sycommon_python_lib-0.2.0/src/sycommon/llm/token_usage_mysql_service.py +882 -0
  69. sycommon_python_lib-0.2.0/src/sycommon/llm/usage_token.py +186 -0
  70. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/kafka_log.py +6 -5
  71. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/logger_wrapper.py +6 -0
  72. sycommon_python_lib-0.2.0/src/sycommon/logging/process_logger.py +177 -0
  73. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/sql_logger.py +2 -2
  74. sycommon_python_lib-0.2.0/src/sycommon/middleware/timeout.py +44 -0
  75. sycommon_python_lib-0.2.0/src/sycommon/models/token_usage.py +25 -0
  76. sycommon_python_lib-0.2.0/src/sycommon/models/token_usage_mysql.py +59 -0
  77. sycommon_python_lib-0.2.0/src/sycommon/notice/uvicorn_monitor.py +346 -0
  78. sycommon_python_lib-0.2.0/src/sycommon/rabbitmq/process_pool_consumer.py +850 -0
  79. sycommon_python_lib-0.2.0/src/sycommon/rabbitmq/rabbitmq_client.py +407 -0
  80. sycommon_python_lib-0.2.0/src/sycommon/rabbitmq/rabbitmq_pool.py +324 -0
  81. sycommon_python_lib-0.2.0/src/sycommon/rabbitmq/rabbitmq_service.py +242 -0
  82. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +104 -63
  83. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +41 -6
  84. sycommon_python_lib-0.2.0/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +243 -0
  85. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/rabbitmq/rabbitmq_service_core.py +19 -6
  86. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +22 -29
  87. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/services.py +69 -11
  88. sycommon_python_lib-0.2.0/src/sycommon/synacos/__init__.py +9 -0
  89. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/example.py +96 -1
  90. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/example2.py +101 -3
  91. sycommon_python_lib-0.2.0/src/sycommon/synacos/feign.py +265 -0
  92. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/feign_client.py +128 -56
  93. sycommon_python_lib-0.2.0/src/sycommon/synacos/nacos_config_manager.py +151 -0
  94. sycommon_python_lib-0.2.0/src/sycommon/synacos/nacos_heartbeat_manager.py +246 -0
  95. sycommon_python_lib-0.2.0/src/sycommon/synacos/nacos_service.py +279 -0
  96. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/nacos_service_discovery.py +76 -6
  97. sycommon_python_lib-0.2.0/src/sycommon/tests/deep_agent_server.py +535 -0
  98. sycommon_python_lib-0.2.0/src/sycommon/tests/skills/web-search/helpers/formatter.py +207 -0
  99. sycommon_python_lib-0.2.0/src/sycommon/tests/skills/web-search/helpers/query_builder.py +144 -0
  100. sycommon_python_lib-0.2.0/src/sycommon/tests/test_deep_agent.py +130 -0
  101. sycommon_python_lib-0.2.0/src/sycommon/tests/test_email.py +172 -0
  102. sycommon_python_lib-0.2.0/src/sycommon/tests/test_mq.py +128 -0
  103. sycommon_python_lib-0.2.0/src/sycommon/tools/async_utils.py +26 -0
  104. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/tools/snowflake.py +15 -0
  105. sycommon_python_lib-0.2.0/src/sycommon/tools/syemail.py +173 -0
  106. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon_python_lib.egg-info/PKG-INFO +21 -15
  107. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon_python_lib.egg-info/SOURCES.txt +67 -0
  108. sycommon_python_lib-0.2.0/src/sycommon_python_lib.egg-info/requires.txt +29 -0
  109. sycommon_python_lib-0.1.59/src/command/cli.py +0 -167
  110. sycommon_python_lib-0.1.59/src/sycommon/llm/embedding.py +0 -358
  111. sycommon_python_lib-0.1.59/src/sycommon/llm/get_llm.py +0 -47
  112. sycommon_python_lib-0.1.59/src/sycommon/llm/llm_logger.py +0 -126
  113. sycommon_python_lib-0.1.59/src/sycommon/llm/usage_token.py +0 -121
  114. sycommon_python_lib-0.1.59/src/sycommon/middleware/timeout.py +0 -20
  115. sycommon_python_lib-0.1.59/src/sycommon/notice/uvicorn_monitor.py +0 -200
  116. sycommon_python_lib-0.1.59/src/sycommon/rabbitmq/rabbitmq_client.py +0 -417
  117. sycommon_python_lib-0.1.59/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -405
  118. sycommon_python_lib-0.1.59/src/sycommon/rabbitmq/rabbitmq_service.py +0 -59
  119. sycommon_python_lib-0.1.59/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -285
  120. sycommon_python_lib-0.1.59/src/sycommon/synacos/feign.py +0 -190
  121. sycommon_python_lib-0.1.59/src/sycommon/synacos/nacos_config_manager.py +0 -107
  122. sycommon_python_lib-0.1.59/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -144
  123. sycommon_python_lib-0.1.59/src/sycommon/synacos/nacos_service.py +0 -151
  124. sycommon_python_lib-0.1.59/src/sycommon/tools/__init__.py +0 -0
  125. sycommon_python_lib-0.1.59/src/sycommon_python_lib.egg-info/requires.txt +0 -23
  126. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/README.md +0 -0
  127. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/setup.cfg +0 -0
  128. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/__init__.py +0 -0
  129. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/DatabaseConfig.py +0 -0
  130. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/EmbeddingConfig.py +0 -0
  131. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/LangfuseConfig.py +0 -0
  132. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/MQConfig.py +0 -0
  133. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/RerankerConfig.py +0 -0
  134. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/SentryConfig.py +0 -0
  135. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/config/__init__.py +0 -0
  136. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/database/async_base_db_service.py +0 -0
  137. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/database/base_db_service.py +0 -0
  138. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/health/__init__.py +0 -0
  139. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/health/health_check.py +0 -0
  140. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/health/metrics.py +0 -0
  141. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/health/ping.py +0 -0
  142. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/llm/__init__.py +0 -0
  143. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/__init__.py +0 -0
  144. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/async_sql_logger.py +0 -0
  145. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/logging/logger_levels.py +0 -0
  146. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/__init__.py +0 -0
  147. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/context.py +0 -0
  148. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/cors.py +0 -0
  149. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/docs.py +0 -0
  150. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/exception.py +0 -0
  151. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/middleware.py +0 -0
  152. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/monitor_memory.py +0 -0
  153. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/mq.py +0 -0
  154. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/middleware/traceid.py +0 -0
  155. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/__init__.py +0 -0
  156. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/base_http.py +0 -0
  157. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/log.py +0 -0
  158. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/mqlistener_config.py +0 -0
  159. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/mqmsg_model.py +0 -0
  160. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/mqsend_config.py +0 -0
  161. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/models/sso_user.py +0 -0
  162. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/notice/__init__.py +0 -0
  163. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/sentry/__init__.py +0 -0
  164. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/sentry/sy_sentry.py +0 -0
  165. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/sse/__init__.py +0 -0
  166. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/sse/event.py +0 -0
  167. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/sse/sse.py +0 -0
  168. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/nacos_client_base.py +0 -0
  169. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/nacos_service_registration.py +0 -0
  170. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/synacos/param.py +0 -0
  171. {sycommon_python_lib-0.1.59/src/sycommon/synacos → sycommon_python_lib-0.2.0/src/sycommon/tools}/__init__.py +0 -0
  172. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/tools/docs.py +0 -0
  173. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/tools/env.py +0 -0
  174. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/tools/merge_headers.py +0 -0
  175. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon/tools/timing.py +0 -0
  176. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
  177. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
  178. {sycommon_python_lib-0.1.59 → sycommon_python_lib-0.2.0}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
@@ -1,32 +1,38 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sycommon-python-lib
3
- Version: 0.1.59
3
+ Version: 0.2.0
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
- Requires-Dist: aio-pika>=9.5.8
7
+ Requires-Dist: aio-pika>=9.6.1
8
8
  Requires-Dist: aiohttp>=3.13.3
9
9
  Requires-Dist: aiomysql>=0.3.2
10
+ Requires-Dist: anyio>=4.12.1
10
11
  Requires-Dist: decorator>=5.2.1
11
- Requires-Dist: fastapi>=0.128.0
12
+ Requires-Dist: deepagents>=0.4.11
13
+ Requires-Dist: elasticsearch>=9.3.0
14
+ Requires-Dist: fastapi>=0.135.1
15
+ Requires-Dist: jinja2>=3.1.6
12
16
  Requires-Dist: kafka-python>=2.3.0
13
- Requires-Dist: langchain>=1.2.3
14
- Requires-Dist: langchain-core>=1.2.7
15
- Requires-Dist: langchain-openai>=1.1.7
16
- Requires-Dist: langfuse>=3.11.2
17
- Requires-Dist: langgraph>=1.0.6
17
+ Requires-Dist: langchain>=1.2.12
18
+ Requires-Dist: langchain-core>=1.2.19
19
+ Requires-Dist: langchain-openai>=1.1.11
20
+ Requires-Dist: langfuse>=4.0.0
21
+ Requires-Dist: langgraph>=1.1.2
18
22
  Requires-Dist: loguru>=0.7.3
19
- Requires-Dist: mysql-connector-python>=9.5.0
23
+ Requires-Dist: mysql-connector-python>=9.6.0
20
24
  Requires-Dist: nacos-sdk-python<3.0,>=2.0.9
21
- Requires-Dist: psutil>=7.2.1
25
+ Requires-Dist: psutil>=7.2.2
22
26
  Requires-Dist: pydantic>=2.12.5
23
- Requires-Dist: python-dotenv>=1.2.1
27
+ Requires-Dist: python-dotenv>=1.2.2
28
+ Requires-Dist: python-multipart>=0.0.22
24
29
  Requires-Dist: pyyaml>=6.0.3
25
- Requires-Dist: sentry-sdk[fastapi]>=2.49.0
26
- Requires-Dist: sqlalchemy[asyncio]>=2.0.45
27
- Requires-Dist: starlette>=0.50.0
30
+ Requires-Dist: redis>=7.3.0
31
+ Requires-Dist: sentry-sdk[fastapi]>=2.54.0
32
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.48
33
+ Requires-Dist: starlette>=0.52.1
28
34
  Requires-Dist: tiktoken>=0.12.0
29
- Requires-Dist: uvicorn>=0.40.0
35
+ Requires-Dist: uvicorn>=0.41.0
30
36
 
31
37
  # sycommon-python-lib
32
38
 
@@ -1,33 +1,39 @@
1
1
  [project]
2
2
  name = "sycommon-python-lib"
3
- version = "0.1.59"
3
+ version = "0.2.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
7
  dependencies = [
8
- "aio-pika>=9.5.8",
8
+ "aio-pika>=9.6.1",
9
9
  "aiohttp>=3.13.3",
10
10
  "aiomysql>=0.3.2",
11
+ "anyio>=4.12.1",
11
12
  "decorator>=5.2.1",
12
- "fastapi>=0.128.0",
13
+ "deepagents>=0.4.11",
14
+ "elasticsearch>=9.3.0",
15
+ "fastapi>=0.135.1",
16
+ "jinja2>=3.1.6",
13
17
  "kafka-python>=2.3.0",
14
- "langchain>=1.2.3",
15
- "langchain-core>=1.2.7",
16
- "langchain-openai>=1.1.7",
17
- "langfuse>=3.11.2",
18
- "langgraph>=1.0.6",
18
+ "langchain>=1.2.12",
19
+ "langchain-core>=1.2.19",
20
+ "langchain-openai>=1.1.11",
21
+ "langfuse>=4.0.0",
22
+ "langgraph>=1.1.2",
19
23
  "loguru>=0.7.3",
20
- "mysql-connector-python>=9.5.0",
24
+ "mysql-connector-python>=9.6.0",
21
25
  "nacos-sdk-python>=2.0.9,<3.0",
22
- "psutil>=7.2.1",
26
+ "psutil>=7.2.2",
23
27
  "pydantic>=2.12.5",
24
- "python-dotenv>=1.2.1",
28
+ "python-dotenv>=1.2.2",
29
+ "python-multipart>=0.0.22",
25
30
  "pyyaml>=6.0.3",
26
- "sentry-sdk[fastapi]>=2.49.0",
27
- "sqlalchemy[asyncio]>=2.0.45",
28
- "starlette>=0.50.0",
31
+ "redis>=7.3.0",
32
+ "sentry-sdk[fastapi]>=2.54.0",
33
+ "sqlalchemy[asyncio]>=2.0.48",
34
+ "starlette>=0.52.1",
29
35
  "tiktoken>=0.12.0",
30
- "uvicorn>=0.40.0",
36
+ "uvicorn>=0.41.0",
31
37
  ]
32
38
 
33
39
  [tool.setuptools]
@@ -0,0 +1,28 @@
1
+ """
2
+ sycommon CLI 工具集
3
+ """
4
+ from .cli import main
5
+ from .core import (
6
+ FeatureOptions,
7
+ print_info,
8
+ print_success,
9
+ print_error,
10
+ print_warning,
11
+ Colors,
12
+ get_all_files_in_directory,
13
+ init_project,
14
+ interactive_feature_selection,
15
+ )
16
+
17
+ __all__ = [
18
+ "main",
19
+ "FeatureOptions",
20
+ "print_info",
21
+ "print_success",
22
+ "print_error",
23
+ "print_warning",
24
+ "Colors",
25
+ "get_all_files_in_directory",
26
+ "init_project",
27
+ "interactive_feature_selection",
28
+ ]
@@ -0,0 +1,309 @@
1
+ """
2
+ sycommon CLI 工具集
3
+
4
+ Usage:
5
+ sycommon init web my_project # 交互式创建Web项目
6
+ sycommon init agent my_project # 交互式创建Agent项目
7
+ sycommon init web my_project --with-db # 命令行指定功能
8
+ sycommon version # 显示版本
9
+ sycommon doctor # 项目健康检查
10
+ """
11
+ import argparse
12
+ import sys
13
+ from importlib.metadata import version, PackageNotFoundError
14
+
15
+ from .core.models import FeatureOptions
16
+ from .core.project import init_project
17
+ from .core.console import print_error, print_info, print_success, print_warning, Colors
18
+
19
+
20
+ def get_version() -> str:
21
+ """获取已安装的库版本"""
22
+ try:
23
+ return version("sycommon-python-lib")
24
+ except PackageNotFoundError:
25
+ return "unknown (未安装)"
26
+
27
+
28
+ def create_init_parser(subparsers) -> None:
29
+ """创建 init 子命令解析器"""
30
+ init_parser = subparsers.add_parser(
31
+ "init",
32
+ help="创建Web/Agent类型项目模板",
33
+ formatter_class=argparse.RawTextHelpFormatter,
34
+ epilog="""
35
+ 示例:
36
+ uv pip install -e .
37
+ sycommon init web my_project # 交互式创建Web项目
38
+ sycommon init agent my_project # 交互式创建Agent项目
39
+ sycommon init web my_project --dry-run # 预览将要创建的文件
40
+ sycommon init web my_project --force # 强制覆盖已存在的目录
41
+ sycommon init web my_project -q # 静默模式(使用默认配置)
42
+ sycommon init web my_project --with-db --with-mq --with-redis --with-es
43
+
44
+ 项目类型说明:
45
+ web - 标准 FastAPI Web 服务,适合 RESTful API 开发
46
+ agent - AI Agent 服务,基于 langgraph 实现状态图
47
+
48
+ Agent 项目结构:
49
+ agent/ - Agent 核心 (main_agent, nodes, states, enums)
50
+ api/sse/ - SSE 流式接口
51
+ tools/ - 工具函数 (含 MQ 处理)
52
+ db/ - 数据库服务
53
+ model/ - 数据模型
54
+
55
+ Web 项目结构:
56
+ api/ - API 接口 (含 SSE)
57
+ tools/ - 工具函数
58
+ model/ - 数据模型
59
+ client/ - 外部服务客户端
60
+
61
+ 功能模块说明:
62
+ database - MySQL 数据库支持 (SQLAlchemy)
63
+ rabbitmq - RabbitMQ 消息队列
64
+ nacos - Nacos 服务注册与配置中心
65
+ kafka_log - Kafka 日志收集
66
+ sse - Server-Sent Events 流式响应
67
+ llm - LLM 大模型支持 (LangChain/LangGraph)
68
+ redis - Redis 缓存服务
69
+ elasticsearch - Elasticsearch 搜索/日志服务
70
+ sentry - Sentry 错误监控
71
+ """
72
+ )
73
+
74
+ # 位置参数
75
+ init_parser.add_argument(
76
+ "project_type",
77
+ choices=["web", "agent"],
78
+ help="项目类型:web / agent"
79
+ )
80
+ init_parser.add_argument(
81
+ "project_name",
82
+ help="工程名称"
83
+ )
84
+
85
+ # 功能选项 - 启用
86
+ feature_group = init_parser.add_argument_group("功能选项 (启用)")
87
+ feature_group.add_argument("--with-db", action="store_true",
88
+ help="启用数据库 (MySQL)")
89
+ feature_group.add_argument("--with-mq", action="store_true",
90
+ help="启用 RabbitMQ 消息队列")
91
+ feature_group.add_argument("--with-sse", action="store_true",
92
+ help="启用 SSE 流式响应")
93
+ feature_group.add_argument("--with-redis", action="store_true",
94
+ help="启用 Redis 缓存")
95
+ feature_group.add_argument("--with-es", action="store_true",
96
+ help="启用 Elasticsearch")
97
+
98
+ # 功能选项 - 禁用
99
+ disable_group = init_parser.add_argument_group("功能选项 (禁用)")
100
+ disable_group.add_argument("--no-nacos", action="store_true",
101
+ help="禁用 Nacos 服务注册")
102
+ disable_group.add_argument("--no-kafka", action="store_true",
103
+ help="禁用 Kafka 日志")
104
+ disable_group.add_argument("--no-llm", action="store_true",
105
+ help="禁用 LLM 大模型支持")
106
+ disable_group.add_argument("--no-sentry", action="store_true",
107
+ help="禁用 Sentry 错误监控")
108
+
109
+ # 行为选项
110
+ behavior_group = init_parser.add_argument_group("行为选项")
111
+ behavior_group.add_argument(
112
+ "-n", "--dry-run", action="store_true", help="仅预览")
113
+ behavior_group.add_argument(
114
+ "-f", "--force", action="store_true", help="强制覆盖")
115
+ behavior_group.add_argument(
116
+ "-q", "--quiet", action="store_true", help="静默模式")
117
+ behavior_group.add_argument(
118
+ "-v", "--verbose", action="store_true", help="详细输出")
119
+
120
+
121
+ def handle_init_command(args) -> bool:
122
+ """处理 init 命令"""
123
+ # 判断是否使用命令行模式
124
+ use_cli_mode = any([
125
+ args.with_db, args.with_mq, args.with_sse, args.with_redis, args.with_es,
126
+ args.no_nacos, args.no_kafka, args.no_llm, args.no_sentry
127
+ ])
128
+
129
+ if use_cli_mode or args.quiet:
130
+ features = FeatureOptions(
131
+ database=args.with_db,
132
+ rabbitmq=args.with_mq,
133
+ nacos=not args.no_nacos,
134
+ kafka_log=not args.no_kafka,
135
+ sse=args.with_sse,
136
+ llm=not args.no_llm,
137
+ redis=args.with_redis,
138
+ elasticsearch=args.with_es,
139
+ sentry=not args.no_sentry,
140
+ )
141
+ else:
142
+ features = None # 交互式选择
143
+
144
+ verbose = args.verbose or not args.quiet
145
+
146
+ return init_project(
147
+ project_name=args.project_name,
148
+ project_type=args.project_type,
149
+ features=features,
150
+ dry_run=args.dry_run,
151
+ force=args.force,
152
+ verbose=verbose
153
+ )
154
+
155
+
156
+ def create_doctor_parser(subparsers) -> None:
157
+ """创建 doctor 子命令解析器"""
158
+ doctor_parser = subparsers.add_parser(
159
+ "doctor",
160
+ help="项目健康检查",
161
+ formatter_class=argparse.RawTextHelpFormatter,
162
+ epilog="""
163
+ 检查项目:
164
+ sycommon doctor # 检查当前目录
165
+ sycommon doctor /path/to/project # 检查指定目录
166
+
167
+ 检查项目:
168
+ - 依赖安装状态
169
+ - 配置文件完整性
170
+ - 环境变量配置
171
+ - 代码规范检查
172
+ """
173
+ )
174
+ doctor_parser.add_argument(
175
+ "path",
176
+ nargs="?",
177
+ default=".",
178
+ help="项目路径 (默认: 当前目录)"
179
+ )
180
+ doctor_parser.add_argument(
181
+ "--fix",
182
+ action="store_true",
183
+ help="自动修复发现的问题"
184
+ )
185
+
186
+
187
+ def handle_doctor_command(args) -> bool:
188
+ """处理 doctor 命令"""
189
+ from pathlib import Path
190
+
191
+ project_path = Path(args.path).resolve()
192
+
193
+ print(f"\n{Colors.HEADER}🔍 项目健康检查{Colors.ENDC}")
194
+ print(f"检查目录: {project_path}")
195
+ print("-" * 50)
196
+
197
+ issues = []
198
+ warnings = []
199
+
200
+ # 1. 检查必要文件
201
+ required_files = ["app.py", "requirements.txt"]
202
+ for file in required_files:
203
+ if not (project_path / file).exists():
204
+ issues.append(f"缺少必要文件: {file}")
205
+
206
+ # 2. 检查配置文件
207
+ config_files = ["app.yaml", ".env"]
208
+ for file in config_files:
209
+ if not (project_path / file).exists():
210
+ warnings.append(f"缺少配置文件: {file}")
211
+
212
+ # 3. 检查目录结构
213
+ recommended_dirs = ["api", "model", "tools", "client"]
214
+ for dir_name in recommended_dirs:
215
+ if not (project_path / dir_name).exists():
216
+ warnings.append(f"缺少推荐目录: {dir_name}/")
217
+
218
+ # 4. 检查 Python 版本
219
+ py_version = sys.version_info
220
+ if py_version < (3, 10):
221
+ issues.append(f"Python 版本过低: {py_version.major}.{py_version.minor},建议 3.10+")
222
+
223
+ # 输出结果
224
+ if issues:
225
+ print_error(f"发现 {len(issues)} 个问题:")
226
+ for issue in issues:
227
+ print(f" ❌ {issue}")
228
+
229
+ if warnings:
230
+ print_warning(f"发现 {len(warnings)} 个警告:")
231
+ for warning in warnings:
232
+ print(f" ⚠️ {warning}")
233
+
234
+ if not issues and not warnings:
235
+ print_success("项目结构检查通过!")
236
+
237
+ # 5. 检查依赖
238
+ print()
239
+ print_info("检查依赖安装状态...")
240
+ try:
241
+ import importlib.util
242
+ packages = [
243
+ ("fastapi", "FastAPI"),
244
+ ("uvicorn", "Uvicorn"),
245
+ ("sycommon", "sycommon-python-lib"),
246
+ ]
247
+ for module, name in packages:
248
+ spec = importlib.util.find_spec(module)
249
+ if spec:
250
+ print_success(f"{name} 已安装")
251
+ else:
252
+ issues.append(f"未安装依赖: {name}")
253
+ except Exception as e:
254
+ warnings.append(f"依赖检查失败: {e}")
255
+
256
+ print("-" * 50)
257
+ if issues:
258
+ print_error(f"检查完成,发现 {len(issues)} 个问题需要修复")
259
+ return False
260
+ else:
261
+ print_success("检查完成,项目健康!")
262
+ return True
263
+
264
+
265
+ def main() -> None:
266
+ """CLI 主入口"""
267
+ parser = argparse.ArgumentParser(
268
+ prog="sycommon",
269
+ description="sycommon 工具集 - 项目初始化与脚手架工具",
270
+ formatter_class=argparse.RawTextHelpFormatter
271
+ )
272
+ subparsers = parser.add_subparsers(
273
+ dest="command", required=True, help="子命令")
274
+
275
+ # 注册子命令
276
+ create_init_parser(subparsers)
277
+ create_doctor_parser(subparsers)
278
+ subparsers.add_parser("version", help="显示版本信息")
279
+
280
+ try:
281
+ args = parser.parse_args()
282
+
283
+ if args.command == "version":
284
+ print(f"sycommon {get_version()}")
285
+ return
286
+
287
+ if args.command == "init":
288
+ success = handle_init_command(args)
289
+ if not success:
290
+ sys.exit(1)
291
+
292
+ if args.command == "doctor":
293
+ success = handle_doctor_command(args)
294
+ if not success:
295
+ sys.exit(1)
296
+
297
+ except argparse.ArgumentError as e:
298
+ print_error(str(e))
299
+ cmd = args.command if 'args' in locals() and hasattr(args, 'command') else ''
300
+ print_info(f"使用 {parser.prog} {cmd} -h 查看帮助")
301
+ sys.exit(1)
302
+ except KeyboardInterrupt:
303
+ print("\n")
304
+ print_info("操作已取消")
305
+ sys.exit(130)
306
+
307
+
308
+ if __name__ == "__main__":
309
+ main()
@@ -0,0 +1,19 @@
1
+ """
2
+ 脚手架工具模块
3
+ """
4
+ from .models import FeatureOptions
5
+ from .console import print_info, print_success, print_error, print_warning, Colors
6
+ from .utils import get_all_files_in_directory
7
+ from .project import init_project, interactive_feature_selection
8
+
9
+ __all__ = [
10
+ "FeatureOptions",
11
+ "print_info",
12
+ "print_success",
13
+ "print_error",
14
+ "print_warning",
15
+ "Colors",
16
+ "get_all_files_in_directory",
17
+ "init_project",
18
+ "interactive_feature_selection",
19
+ ]
@@ -0,0 +1,36 @@
1
+ """
2
+ 控制台输出工具
3
+ """
4
+
5
+
6
+ class Colors:
7
+ """颜色输出"""
8
+ HEADER = '\033[95m'
9
+ OKBLUE = '\033[94m'
10
+ OKCYAN = '\033[96m'
11
+ OKGREEN = '\033[92m'
12
+ WARNING = '\033[93m'
13
+ FAIL = '\033[91m'
14
+ ENDC = '\033[0m'
15
+ BOLD = '\033[1m'
16
+
17
+
18
+ def print_info(msg: str, verbose: bool = True) -> None:
19
+ """打印信息"""
20
+ if verbose:
21
+ print(f"{Colors.OKCYAN}ℹ {msg}{Colors.ENDC}")
22
+
23
+
24
+ def print_success(msg: str) -> None:
25
+ """打印成功"""
26
+ print(f"{Colors.OKGREEN}✅ {msg}{Colors.ENDC}")
27
+
28
+
29
+ def print_error(msg: str) -> None:
30
+ """打印错误"""
31
+ print(f"{Colors.FAIL}❌ {msg}{Colors.ENDC}")
32
+
33
+
34
+ def print_warning(msg: str) -> None:
35
+ """打印警告"""
36
+ print(f"{Colors.WARNING}⚠️ {msg}{Colors.ENDC}")
@@ -0,0 +1,47 @@
1
+ """
2
+ CLI 数据模型
3
+ """
4
+ from dataclasses import dataclass, field
5
+ from typing import Dict
6
+
7
+
8
+ @dataclass
9
+ class FeatureOptions:
10
+ """功能模块选项"""
11
+ database: bool = False
12
+ rabbitmq: bool = False
13
+ nacos: bool = True # 默认开启
14
+ kafka_log: bool = True # 默认开启
15
+ sse: bool = False
16
+ llm: bool = True # 默认开启
17
+ redis: bool = False # Redis 缓存
18
+ elasticsearch: bool = False # Elasticsearch 日志/Token记录
19
+ sentry: bool = True # Sentry 错误监控,默认开启
20
+
21
+ def to_template_vars(self) -> dict:
22
+ """转换为模板变量"""
23
+ return {
24
+ "feature_database": str(self.database).lower(),
25
+ "feature_rabbitmq": str(self.rabbitmq).lower(),
26
+ "feature_nacos": str(self.nacos).lower(),
27
+ "feature_kafka_log": str(self.kafka_log).lower(),
28
+ "feature_sse": str(self.sse).lower(),
29
+ "feature_llm": str(self.llm).lower(),
30
+ "feature_redis": str(self.redis).lower(),
31
+ "feature_elasticsearch": str(self.elasticsearch).lower(),
32
+ "feature_sentry": str(self.sentry).lower(),
33
+ }
34
+
35
+ def get_enabled_features(self) -> Dict[str, bool]:
36
+ """获取所有启用的功能"""
37
+ return {
38
+ "database": self.database,
39
+ "rabbitmq": self.rabbitmq,
40
+ "nacos": self.nacos,
41
+ "kafka_log": self.kafka_log,
42
+ "sse": self.sse,
43
+ "llm": self.llm,
44
+ "redis": self.redis,
45
+ "elasticsearch": self.elasticsearch,
46
+ "sentry": self.sentry,
47
+ }