arcade-core 4.2.0__tar.gz → 4.2.1__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 (35) hide show
  1. {arcade_core-4.2.0 → arcade_core-4.2.1}/PKG-INFO +2 -1
  2. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/identity.py +11 -13
  3. {arcade_core-4.2.0 → arcade_core-4.2.1}/pyproject.toml +2 -1
  4. {arcade_core-4.2.0 → arcade_core-4.2.1}/.gitignore +0 -0
  5. {arcade_core-4.2.0 → arcade_core-4.2.1}/README.md +0 -0
  6. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/__init__.py +0 -0
  7. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/annotations.py +0 -0
  8. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/auth.py +0 -0
  9. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/auth_tokens.py +0 -0
  10. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/catalog.py +0 -0
  11. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/config.py +0 -0
  12. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/config_model.py +0 -0
  13. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/constants.py +0 -0
  14. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/context.py +0 -0
  15. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/converters/__init__.py +0 -0
  16. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/converters/anthropic.py +0 -0
  17. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/converters/openai.py +0 -0
  18. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/converters/utils.py +0 -0
  19. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/discovery.py +0 -0
  20. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/errors.py +0 -0
  21. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/executor.py +0 -0
  22. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/network/__init__.py +0 -0
  23. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/network/org_transport.py +0 -0
  24. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/output.py +0 -0
  25. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/parse.py +0 -0
  26. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/py.typed +0 -0
  27. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/schema.py +0 -0
  28. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/toolkit.py +0 -0
  29. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/__init__.py +0 -0
  30. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/__main__.py +0 -0
  31. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/constants.py +0 -0
  32. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/usage_service.py +0 -0
  33. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/usage/utils.py +0 -0
  34. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/utils.py +0 -0
  35. {arcade_core-4.2.0 → arcade_core-4.2.1}/arcade_core/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arcade-core
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: Arcade Core - Core library for Arcade platform
5
5
  Author-email: Arcade <dev@arcade.dev>
6
6
  License: MIT
@@ -16,6 +16,7 @@ Requires-Python: >=3.10
16
16
  Requires-Dist: httpx>=0.27.0
17
17
  Requires-Dist: loguru>=0.7.0
18
18
  Requires-Dist: packaging>=24.1
19
+ Requires-Dist: portalocker>=2.10.0
19
20
  Requires-Dist: pydantic>=2.7.0
20
21
  Requires-Dist: pyjwt>=2.8.0
21
22
  Requires-Dist: pyyaml>=6.0
@@ -6,7 +6,6 @@ supporting pre-login anonymous tracking, post-login identity stitching,
6
6
  and logout identity rotation.
7
7
  """
8
8
 
9
- import fcntl
10
9
  import json
11
10
  import os
12
11
  import tempfile
@@ -14,6 +13,7 @@ import uuid
14
13
  from typing import Any
15
14
 
16
15
  import httpx
16
+ import portalocker
17
17
  import yaml
18
18
 
19
19
  from arcade_core.constants import ARCADE_CONFIG_PATH, CREDENTIALS_FILE_PATH
@@ -46,18 +46,16 @@ class UsageIdentity:
46
46
  if os.path.exists(self.usage_file_path):
47
47
  try:
48
48
  with open(self.usage_file_path) as f:
49
- # lock file
50
- if os.name != "nt": # Unix-like systems
51
- fcntl.flock(f.fileno(), fcntl.LOCK_SH)
49
+ # Lock file for reading (shared lock)
50
+ portalocker.lock(f, portalocker.LOCK_SH)
52
51
  try:
53
52
  data = json.load(f)
54
53
  if isinstance(data, dict) and KEY_ANON_ID in data:
55
54
  self._data = data
56
55
  return self._data
57
56
  finally:
58
- # unlock file
59
- if os.name != "nt":
60
- fcntl.flock(f.fileno(), fcntl.LOCK_UN)
57
+ # Unlock file
58
+ portalocker.unlock(f)
61
59
  except Exception: # noqa: S110
62
60
  pass
63
61
 
@@ -80,18 +78,18 @@ class UsageIdentity:
80
78
 
81
79
  try:
82
80
  with os.fdopen(temp_fd, "w") as f:
83
- # lock file
84
- if os.name != "nt": # Unix-like systems
85
- fcntl.flock(f.fileno(), fcntl.LOCK_EX)
81
+ # Lock file for writing (exclusive lock)
82
+ portalocker.lock(f, portalocker.LOCK_EX)
86
83
  try:
87
84
  json.dump(data, f, indent=2)
88
85
  f.flush()
89
86
  os.fsync(f.fileno()) # ensure data is written to disk
90
87
  finally:
91
- if os.name != "nt":
92
- fcntl.flock(f.fileno(), fcntl.LOCK_UN)
88
+ portalocker.unlock(f)
93
89
 
94
- os.rename(temp_path, self.usage_file_path)
90
+ # Use os.replace() for cross-platform atomic file replacement
91
+ # os.replace() is atomic on both Unix and Windows (Python 3.3+)
92
+ os.replace(temp_path, self.usage_file_path)
95
93
  except Exception:
96
94
  # clean up
97
95
  import contextlib
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "arcade-core"
3
- version = "4.2.0"
3
+ version = "4.2.1"
4
4
  description = "Arcade Core - Core library for Arcade platform"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -24,6 +24,7 @@ dependencies = [
24
24
  "toml>=0.10.2",
25
25
  "httpx>=0.27.0",
26
26
  "packaging>=24.1",
27
+ "portalocker>=2.10.0",
27
28
  "types-python-dateutil==2.9.0.20241003",
28
29
  "types-pytz==2024.2.0.20241003",
29
30
  "types-toml==0.10.8.20240310",
File without changes
File without changes