crypto-ws-api 2.1.3__tar.gz → 2.1.5__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,3 +1,12 @@
1
+ ## 2.1.5 - 2026-01-29
2
+ 🧹 chore(version/websockets): Bump to **2.1.5** and update `websockets` to **16.0**
3
+
4
+ ## 2.1.4 - 2025-12-02
5
+ - Add optional root logger configuration to set_logger()
6
+ - Introduce malloc_trim() wrapper for C library memory management
7
+ - Invoke malloc_trim() in WSSession cleanup for memory optimization
8
+ - Update __init__.py and CHANGELOG.md for version 2.1.4
9
+
1
10
  ## 2.1.3 - 2025-10-16
2
11
  ✨ feat(ws_session.py): Add `tasks_cancel()` for structured task cancellation with logging
3
12
  ♻️ refactor(ws_session.py): Refactor task cancellation and stop logic to use `tasks_cancel()`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crypto-ws-api
3
- Version: 2.1.3
3
+ Version: 2.1.5
4
4
  Summary: Crypto WS API connector for ASYNC requests
5
5
  Author-email: Jerry Fedorenko <jerry.fedorenko@yahoo.com>
6
6
  Requires-Python: >=3.10
@@ -14,7 +14,7 @@ Classifier: Operating System :: MacOS
14
14
  Requires-Dist: shortuuid~=1.0.13
15
15
  Requires-Dist: platformdirs==4.5.0
16
16
  Requires-Dist: toml~=0.10.2
17
- Requires-Dist: websockets==15.0.1
17
+ Requires-Dist: websockets==16.0
18
18
  Requires-Dist: ujson~=5.11.0
19
19
  Requires-Dist: cryptography~=46.0.3
20
20
  Project-URL: Source, https://github.com/DogsTailFarmer/crypto-ws-api
@@ -13,7 +13,7 @@ __maintainer__ = "Jerry Fedorenko"
13
13
  __contact__ = "https://github.com/DogsTailFarmer"
14
14
  __email__ = "jerry.fedorenko@yahoo.com"
15
15
  __credits__ = ["https://github.com/DanyaSWorlD"]
16
- __version__ = "2.1.3"
16
+ __version__ = "2.1.5"
17
17
 
18
18
  from pathlib import Path
19
19
  import shutil
@@ -17,6 +17,7 @@ from datetime import datetime, timezone
17
17
  from urllib.parse import urlencode, urlparse
18
18
  from cryptography.hazmat.primitives.serialization import load_pem_private_key
19
19
  import inspect
20
+ import ctypes, ctypes.util
20
21
 
21
22
  from websockets.asyncio.client import connect
22
23
  from websockets import ConnectionClosed
@@ -31,7 +32,7 @@ sys.tracebacklimit = 0
31
32
  ALPHABET = string.ascii_letters + string.digits
32
33
  CONST_WS_START = "userDataStream.start"
33
34
 
34
- def set_logger(name, log_file, file_level=logging.INFO, propagate=False):
35
+ def set_logger(name, log_file, file_level=logging.INFO, propagate=False, set_root_logger=False):
35
36
  formatter = logging.Formatter(fmt="[%(asctime)s: %(levelname)s] %(message)s")
36
37
  #
37
38
  fh = logging.handlers.RotatingFileHandler(log_file, maxBytes=1000000, backupCount=10)
@@ -47,10 +48,18 @@ def set_logger(name, log_file, file_level=logging.INFO, propagate=False):
47
48
  _logger.addHandler(sh)
48
49
  _logger.propagate = propagate
49
50
 
51
+ if set_root_logger:
52
+ root_logger = logging.getLogger()
53
+ root_logger.setLevel(min([fh.level, sh.level]))
54
+ root_logger.addHandler(fh)
55
+ root_logger.addHandler(sh)
56
+
50
57
  return _logger
51
58
 
52
59
  logger = set_logger(__name__, Path(LOG_PATH, 'ws_session.log'))
53
60
 
61
+ def malloc_trim(trim_type: int = 0):
62
+ ctypes.CDLL(ctypes.util.find_library('c')).malloc_trim(trim_type)
54
63
 
55
64
  def generate_signature(exchange: str, secret: str, data: str) -> str:
56
65
  encoding = "utf-8"
@@ -225,6 +234,7 @@ class UserWSS:
225
234
  await tasks_cancel(self.tasks, _logger=self.logger)
226
235
  self._response_pool.clear()
227
236
  gc.collect()
237
+ malloc_trim()
228
238
 
229
239
  async def start_wss(self):
230
240
  async for self._ws in connect(
@@ -20,7 +20,7 @@ dependencies = [
20
20
  "shortuuid~=1.0.13",
21
21
  "platformdirs==4.5.0",
22
22
  "toml~=0.10.2",
23
- "websockets==15.0.1",
23
+ "websockets==16.0",
24
24
  "ujson~=5.11.0",
25
25
  "cryptography~=46.0.3"
26
26
  ]
@@ -1,6 +1,6 @@
1
1
  shortuuid~=1.0.13
2
2
  platformdirs==4.5.0
3
3
  toml~=0.10.2
4
- websockets==15.0.1
4
+ websockets==16.0
5
5
  ujson~=5.11.0
6
6
  cryptography~=46.0.3
File without changes
File without changes