Xinops 1.2.2__tar.gz → 1.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xinops
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: 营销数据运维工具库:Hive交互、企业微信/飞书消息、Excel/飞书表格、邮件推送等一体化工具集
5
5
  Author: DongYang
6
6
  Author-email: 649898871@qq.com
@@ -1,7 +1,7 @@
1
1
  # xinops/__init__.py
2
2
 
3
3
  # 包版本号 —— 唯一版本源:setup.cfg 通过 attr: 自动读取这里,发版只需改这一行
4
- __version__ = "1.2.2"
4
+ __version__ = "1.2.3"
5
5
 
6
6
  # 各功能模块 Mixin 导入
7
7
  from ._core import CoreMixin
@@ -15,11 +15,14 @@ SECRETS_FILE_NAMES = ("xinops_secrets.yaml", "pypi_ku_secrets.yaml")
15
15
 
16
16
 
17
17
  def _make_stdout_gbk_safe():
18
- """让控制台输出在 GBK 终端永不崩溃。
18
+ """让控制台输出在 GBK 终端永不崩溃 + 强制行缓冲立即上屏。
19
19
 
20
- 背景:任务计划/双击运行的 cmd 是 GBK(cp936),print emoji(等)会抛
20
+ 背景1:任务计划/双击运行的 cmd 是 GBK(cp936),print emoji(等)会抛
21
21
  UnicodeEncodeError 中断任务。本函数在包导入时把 stdout/stderr 包装为
22
22
  errors='replace':不可编码字符显示为 ?(功能无损),UTF-8 终端完全不受影响。
23
+ 背景2:PyCharm 运行台等非 tty 环境默认块缓冲(攒约8KB才上屏),表现为
24
+ "程序快结束才一次性打印全部日志"。此处统一设 line_buffering=True:
25
+ 每遇换行立即刷新,所有 print(含业务脚本自己的)实时可见。
23
26
  (对已重配置过的解释器幂等)
24
27
  """
25
28
  for name in ("stdout", "stderr"):
@@ -27,11 +30,14 @@ def _make_stdout_gbk_safe():
27
30
  if stream is None or not hasattr(stream, "buffer"):
28
31
  continue
29
32
  enc = getattr(stream, "encoding", "") or "utf-8"
30
- if "replace" in (getattr(stream, "errors", "") or ""):
31
- continue # 已是安全模式
33
+ # 幂等:errors 已是 replace 且已是行缓冲才跳过
34
+ # (注意 -X utf8 解释器默认 errors=replace 但 line_buffering=False,不能只看 errors)
35
+ if "replace" in (getattr(stream, "errors", "") or "") and \
36
+ getattr(stream, "line_buffering", False):
37
+ continue
32
38
  try:
33
39
  new_stream = io.TextIOWrapper(stream.buffer, encoding=enc, errors="replace",
34
- line_buffering=getattr(stream, "line_buffering", False))
40
+ line_buffering=True)
35
41
  setattr(sys, name, new_stream)
36
42
  except Exception:
37
43
  pass # 包装失败则保持原样(极端环境,不因初始化崩掉导入)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xinops
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: 营销数据运维工具库:Hive交互、企业微信/飞书消息、Excel/飞书表格、邮件推送等一体化工具集
5
5
  Author: DongYang
6
6
  Author-email: 649898871@qq.com
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes