ygo 1.1.0__tar.gz → 1.1.2__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.

Potentially problematic release.


This version of ygo might be problematic. Click here for more details.

@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygo
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
+ Summary: 一个轻量级 Python 工具包,支持 并发执行(带进度条)、延迟调用、链式绑定参数、函数信息获取、模块/函数动态加载。并结合 ylog 提供日志记录能力
4
5
  Project-URL: homepage, https://github.com/link-yundi/ygo
5
6
  Project-URL: repository, https://github.com/link-yundi/ygo
6
7
  Requires-Python: >=3.12
@@ -54,7 +55,7 @@ import ygo
54
55
  import ylog
55
56
  from a.b.c import test_fn
56
57
 
57
- with ygo.pool(job_name="test parallel", show_progress=True) as go:
58
+ with ygo.pool(n_jobs=5, show_progress=True) as go:
58
59
  for i in range(10):
59
60
  go.submit(test_fn)(a=i, b=2*i)
60
61
  for res in go.do():
@@ -41,7 +41,7 @@ import ygo
41
41
  import ylog
42
42
  from a.b.c import test_fn
43
43
 
44
- with ygo.pool(job_name="test parallel", show_progress=True) as go:
44
+ with ygo.pool(n_jobs=5, show_progress=True) as go:
45
45
  for i in range(10):
46
46
  go.submit(test_fn)(a=i, b=2*i)
47
47
  for res in go.do():
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ygo"
7
- version = "v1.1.0"
8
- description = ""
7
+ version = "v1.1.2"
8
+ description = "一个轻量级 Python 工具包,支持 并发执行(带进度条)、延迟调用、链式绑定参数、函数信息获取、模块/函数动态加载。并结合 ylog 提供日志记录能力"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
11
11
  dependencies = [
@@ -20,7 +20,7 @@ from .utils import (
20
20
  fn_from_str,
21
21
  )
22
22
 
23
- __version__ = "v1.1.0"
23
+ __version__ = "v1.1.2"
24
24
 
25
25
  __all__ = [
26
26
  "FailTaskError",
@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygo
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
+ Summary: 一个轻量级 Python 工具包,支持 并发执行(带进度条)、延迟调用、链式绑定参数、函数信息获取、模块/函数动态加载。并结合 ylog 提供日志记录能力
4
5
  Project-URL: homepage, https://github.com/link-yundi/ygo
5
6
  Project-URL: repository, https://github.com/link-yundi/ygo
6
7
  Requires-Python: >=3.12
@@ -54,7 +55,7 @@ import ygo
54
55
  import ylog
55
56
  from a.b.c import test_fn
56
57
 
57
- with ygo.pool(job_name="test parallel", show_progress=True) as go:
58
+ with ygo.pool(n_jobs=5, show_progress=True) as go:
58
59
  for i in range(10):
59
60
  go.submit(test_fn)(a=i, b=2*i)
60
61
  for res in go.do():
@@ -9,7 +9,7 @@ Created on 2025/5/14 15:37
9
9
 
10
10
  from .core import trace, debug, info, warning, error, critical, update_config, get_logger
11
11
 
12
- __version__ = "v0.0.1"
12
+ __version__ = "v1.1.2"
13
13
 
14
14
  __all__ = [
15
15
  "trace",
@@ -9,7 +9,6 @@ Created on 2025/5/14 16:04
9
9
 
10
10
  import sys
11
11
  from pathlib import Path
12
- from threading import Lock
13
12
  from typing import Optional
14
13
 
15
14
  from loguru import logger
@@ -23,8 +22,7 @@ class _Logger:
23
22
  1. 高性能:异步写入日志,避免阻塞主线程
24
23
  2. 易于管理:多级别日志分离存储,按日期和大小轮转
25
24
  3. 分级明确:支持 TRACE/DEBUG/INFO/WARNING/ERROR/CRITICAL 级别
26
- 4. 结构化日志:支持 JSON 格式日志输出
27
- 5. 全局异常捕获:自动记录未处理异常
25
+ 4. 全局异常捕获:自动记录未处理异常
28
26
  """
29
27
 
30
28
  def __new__(cls, *args, **kwargs):
@@ -34,7 +32,7 @@ class _Logger:
34
32
  def __init__(
35
33
  self,
36
34
  log_dir: str = "logs",
37
- app_name: str|None = None,
35
+ app_name: str | None = None,
38
36
  retention_days: int = 7,
39
37
  error_retention_days: int = 30,
40
38
  enable_console: bool = True,
@@ -110,11 +108,11 @@ class _Logger:
110
108
  }
111
109
 
112
110
  # 错误级别以上的日志
113
- error_levels = ("WARNING", "ERROR", "CRITICAL")
114
- _error_log_file = f"{self.app_name}_{{time:YYYY-MM-DD}}.err.log" if self.app_name is not None else f"{{time:YYYY-MM-DD}}.err.log"
111
+ error_levels = ("ERROR", "CRITICAL")
112
+ _error_log_file = f"{self.app_name}_{{time:YYYYMMDD}}.err.log" if self.app_name is not None else f"{{time:YYYYMMDD}}.err.log"
115
113
  error_log_file = self.log_dir / _error_log_file
116
- info_levels = ("INFO", "DEBUG", "TRACE")
117
- _info_log_file = f"{self.app_name}_{{time:YYYY-MM-DD}}.log" if self.app_name is not None else f"{{time:YYYY-MM-DD}}.log"
114
+ info_levels = ("INFO", "DEBUG", "TRACE", "WARNING")
115
+ _info_log_file = f"{self.app_name}_{{time:YYYYMMDD}}.log" if self.app_name is not None else f"{{time:YYYYMMDD}}.log"
118
116
  info_log_file = self.log_dir / _info_log_file
119
117
  # 错误级别以上的日志
120
118
  logger.add(
@@ -145,8 +143,6 @@ class _Logger:
145
143
  catch=True # 捕获格式化异常
146
144
  )
147
145
 
148
-
149
-
150
146
  def _setup_global_exception_handling(self):
151
147
  """配置全局异常捕获"""
152
148
 
@@ -230,6 +226,7 @@ class _Logger:
230
226
  if enable_file is not False:
231
227
  self._setup_file_logging(self._retention_days, self._error_retention_days)
232
228
 
229
+
233
230
  # 初始化默认实例
234
231
  _default_logger = _Logger()
235
232
 
@@ -242,6 +239,7 @@ error = _default_logger.error
242
239
  critical = _default_logger.critical
243
240
  update_config = _default_logger.update_config
244
241
 
242
+
245
243
  def get_logger(app_name: str,
246
244
  log_dir: str = "logs",
247
245
  retention_days: int = 7,
@@ -259,4 +257,3 @@ def get_logger(app_name: str,
259
257
  enable_file=enable_file,
260
258
  debug_mode=debug_mode
261
259
  )
262
-
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