portacode 1.3.27__py3-none-any.whl → 1.3.27.dev1__py3-none-any.whl
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.
- portacode/_version.py +2 -2
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/METADATA +1 -1
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/RECORD +7 -8
- portacode/utils/NTP_ARCHITECTURE.md +0 -136
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/WHEEL +0 -0
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/entry_points.txt +0 -0
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/licenses/LICENSE +0 -0
- {portacode-1.3.27.dist-info → portacode-1.3.27.dev1.dist-info}/top_level.txt +0 -0
portacode/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.3.27'
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 3, 27)
|
|
31
|
+
__version__ = version = '1.3.27.dev1'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 3, 27, 'dev1')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
portacode/README.md,sha256=4dKtpvR8LNgZPVz37GmkQCMWIr_u25Ao63iW56s7Ke4,775
|
|
2
2
|
portacode/__init__.py,sha256=oB3sV1wXr-um-RXio73UG8E5Xx6cF2ZVJveqjNmC-vQ,1086
|
|
3
3
|
portacode/__main__.py,sha256=jmHTGC1hzmo9iKJLv-SSYe9BSIbPPZ2IOpecI03PlTs,296
|
|
4
|
-
portacode/_version.py,sha256=
|
|
4
|
+
portacode/_version.py,sha256=__3W72Vcvh990Z238N2VaJ8keiMTtgdf7iI_1_6HAtI,719
|
|
5
5
|
portacode/cli.py,sha256=eDqcZMVFHKzqqWxedhhx8ylu5WMVCLqeJQkbPR7RcJE,16333
|
|
6
6
|
portacode/data.py,sha256=5-s291bv8J354myaHm1Y7CQZTZyRzMU3TGe5U4hb-FA,1591
|
|
7
7
|
portacode/keypair.py,sha256=PAcOYqlVLOoZTPYi6LvLjfsY6BkrWbLOhSZLb8r5sHs,3635
|
|
@@ -35,10 +35,9 @@ portacode/connection/handlers/project_state/models.py,sha256=EZTKvxHKs8QlQUbzI0u
|
|
|
35
35
|
portacode/connection/handlers/project_state/utils.py,sha256=LsbQr9TH9Bz30FqikmtTxco4PlB_n0kUIuPKQ6Fb_mo,1665
|
|
36
36
|
portacode/static/js/test-ntp-clock.html,sha256=bUow9sifIuLNPqKvuPbpQozmEE6RhdCI4Plib3CqUmw,2130
|
|
37
37
|
portacode/static/js/utils/ntp-clock.js,sha256=KMeHGT-IlUSlxVRZZ899z25dQCJh6EJbgXjlh8dD8vA,4495
|
|
38
|
-
portacode/utils/NTP_ARCHITECTURE.md,sha256=WkESTbz5SNAgdmDKk3DrHMhtYOPji_Kt3_a9arWdRig,3894
|
|
39
38
|
portacode/utils/__init__.py,sha256=NgBlWTuNJESfIYJzP_3adI1yJQJR0XJLRpSdVNaBAN0,33
|
|
40
39
|
portacode/utils/ntp_clock.py,sha256=6QJOVZr9VQuxIyJt9KNG4dR-nZ3bKNyipMxjqDWP89Y,5152
|
|
41
|
-
portacode-1.3.27.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
|
|
40
|
+
portacode-1.3.27.dev1.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
|
|
42
41
|
test_modules/README.md,sha256=Do_agkm9WhSzueXjRAkV_xEj6Emy5zB3N3VKY5Roce8,9274
|
|
43
42
|
test_modules/__init__.py,sha256=1LcbHodIHsB0g-g4NGjSn6AMuCoGbymvXPYLOb6Z7F0,53
|
|
44
43
|
test_modules/test_device_online.py,sha256=yiSyVaMwKAugqIX_ZIxmLXiOlmA_8IRXiUp12YmpB98,1653
|
|
@@ -63,8 +62,8 @@ testing_framework/core/playwright_manager.py,sha256=9kGXJtRpRNEhaSlV7XVXvx4UQSHS
|
|
|
63
62
|
testing_framework/core/runner.py,sha256=j2QwNJmAxVBmJvcbVS7DgPJUKPNzqfLmt_4NNdaKmZU,19297
|
|
64
63
|
testing_framework/core/shared_cli_manager.py,sha256=BESSNtyQb7BOlaOvZmm04T8Uezjms4KCBs2MzTxvzYQ,8790
|
|
65
64
|
testing_framework/core/test_discovery.py,sha256=2FZ9fJ8Dp5dloA-fkgXoJ_gCMC_nYPBnA3Hs2xlagzM,4928
|
|
66
|
-
portacode-1.3.27.dist-info/METADATA,sha256=
|
|
67
|
-
portacode-1.3.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
-
portacode-1.3.27.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
|
|
69
|
-
portacode-1.3.27.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
70
|
-
portacode-1.3.27.dist-info/RECORD,,
|
|
65
|
+
portacode-1.3.27.dev1.dist-info/METADATA,sha256=x5Uy8Re8oUeOEzqpwpywke4MeknBGAu0f1O6XD3XMEU,6994
|
|
66
|
+
portacode-1.3.27.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
67
|
+
portacode-1.3.27.dev1.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
|
|
68
|
+
portacode-1.3.27.dev1.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
69
|
+
portacode-1.3.27.dev1.dist-info/RECORD,,
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
# NTP Clock Architecture
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
All entities (client, server, device) synchronize to **time.cloudflare.com** for distributed tracing.
|
|
6
|
-
|
|
7
|
-
## Architecture: Single Package for Everything
|
|
8
|
-
|
|
9
|
-
All NTP clock implementations (Python and JavaScript) are in the **portacode package** to ensure DRY principles.
|
|
10
|
-
|
|
11
|
-
## Python Implementation
|
|
12
|
-
|
|
13
|
-
**Location:** `portacode/utils/ntp_clock.py` (in portacode package)
|
|
14
|
-
|
|
15
|
-
### Import Path
|
|
16
|
-
```python
|
|
17
|
-
from portacode.utils.ntp_clock import ntp_clock
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Usage Locations
|
|
21
|
-
1. **Django Server Consumers** (`server/portacode_django/dashboard/consumers.py`)
|
|
22
|
-
2. **Device Base Handlers** (`portacode/connection/handlers/base.py`)
|
|
23
|
-
3. **Device Client** (`server/portacode_django/data/services/device_client.py`)
|
|
24
|
-
4. **Any Python code with portacode installed**
|
|
25
|
-
|
|
26
|
-
### Dependencies
|
|
27
|
-
- `setup.py`: Added `ntplib>=0.4.0` to `install_requires`
|
|
28
|
-
- `server/portacode_django/requirements.txt`: Added `portacode>=1.3.26`
|
|
29
|
-
|
|
30
|
-
### API
|
|
31
|
-
```python
|
|
32
|
-
# Get NTP-synchronized timestamp (None if not synced)
|
|
33
|
-
ntp_clock.now_ms() # milliseconds
|
|
34
|
-
ntp_clock.now() # seconds
|
|
35
|
-
ntp_clock.now_iso() # ISO format
|
|
36
|
-
|
|
37
|
-
# Check sync status
|
|
38
|
-
status = ntp_clock.get_status()
|
|
39
|
-
# {
|
|
40
|
-
# 'server': 'time.cloudflare.com',
|
|
41
|
-
# 'offset_ms': 6.04,
|
|
42
|
-
# 'last_sync': '2025-10-05T04:37:12.768445+00:00',
|
|
43
|
-
# 'is_synced': True
|
|
44
|
-
# }
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## JavaScript Implementation
|
|
48
|
-
|
|
49
|
-
**Location:** `portacode/static/js/utils/ntp-clock.js` (in portacode package)
|
|
50
|
-
|
|
51
|
-
### Django Setup
|
|
52
|
-
|
|
53
|
-
Django will serve static files from the portacode package automatically after `collectstatic`:
|
|
54
|
-
|
|
55
|
-
```python
|
|
56
|
-
# Django settings.py - no changes needed, just ensure:
|
|
57
|
-
INSTALLED_APPS = [
|
|
58
|
-
# ... other apps
|
|
59
|
-
'portacode', # Add portacode as an installed app (optional, for admin integration)
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
# Static files will be collected from portacode package
|
|
63
|
-
STATIC_URL = '/static/'
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
After installing portacode (`pip install portacode` or `pip install -e .`), run:
|
|
67
|
-
```bash
|
|
68
|
-
python manage.py collectstatic
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
This will copy `portacode/static/js/utils/ntp-clock.js` to Django's static files directory.
|
|
72
|
-
|
|
73
|
-
### Import Path (in Django templates/JS)
|
|
74
|
-
```javascript
|
|
75
|
-
import ntpClock from '/static/js/utils/ntp-clock.js';
|
|
76
|
-
// or relative to your JS file:
|
|
77
|
-
import ntpClock from './utils/ntp-clock.js';
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Usage Locations
|
|
81
|
-
1. **Dashboard WebSocket** (`websocket-service.js`)
|
|
82
|
-
2. **Project WebSocket** (`websocket-service-project.js`)
|
|
83
|
-
|
|
84
|
-
### API
|
|
85
|
-
```javascript
|
|
86
|
-
// Get NTP-synchronized timestamp (null if not synced)
|
|
87
|
-
ntpClock.now() // milliseconds
|
|
88
|
-
ntpClock.nowISO() // ISO format
|
|
89
|
-
|
|
90
|
-
// Check sync status
|
|
91
|
-
const status = ntpClock.getStatus();
|
|
92
|
-
// {
|
|
93
|
-
// server: 'time.cloudflare.com',
|
|
94
|
-
// offset: 6.04,
|
|
95
|
-
// lastSync: '2025-10-05T04:37:12.768445+00:00',
|
|
96
|
-
// isSynced: true
|
|
97
|
-
// }
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Design Principles
|
|
101
|
-
|
|
102
|
-
1. **DRY (Don't Repeat Yourself)**
|
|
103
|
-
- **Python:** Single implementation in portacode package (`portacode/utils/ntp_clock.py`)
|
|
104
|
-
- **JavaScript:** Single implementation in portacode package (`portacode/static/js/utils/ntp-clock.js`)
|
|
105
|
-
- Both served from the same package, no duplication across repos
|
|
106
|
-
|
|
107
|
-
2. **No Fallback Servers**
|
|
108
|
-
- All entities MUST sync to time.cloudflare.com
|
|
109
|
-
- If sync fails, timestamps are None/null
|
|
110
|
-
- Ensures all timestamps are comparable
|
|
111
|
-
|
|
112
|
-
3. **Auto-Sync**
|
|
113
|
-
- Re-syncs every 5 minutes automatically
|
|
114
|
-
- Initial sync on import/load
|
|
115
|
-
- Max 3 retry attempts before marking as failed
|
|
116
|
-
|
|
117
|
-
4. **Thread-Safe (Python)**
|
|
118
|
-
- Uses threading.Lock for concurrent access
|
|
119
|
-
- Background daemon thread for periodic sync
|
|
120
|
-
|
|
121
|
-
## Testing
|
|
122
|
-
|
|
123
|
-
### Python
|
|
124
|
-
```bash
|
|
125
|
-
python tools/test_python_ntp_clock.py
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### JavaScript
|
|
129
|
-
The test file is included in the package at `portacode/static/js/test-ntp-clock.html`.
|
|
130
|
-
|
|
131
|
-
After Django collectstatic, open: `/static/js/test-ntp-clock.html` in browser
|
|
132
|
-
|
|
133
|
-
Or run directly from package:
|
|
134
|
-
```bash
|
|
135
|
-
python -c "import portacode, os; print(os.path.join(os.path.dirname(portacode.__file__), 'static/js/test-ntp-clock.html'))"
|
|
136
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|