lightning-pose-app 2.0.4__py3-none-any.whl → 2.0.4.1__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.
- {lightning_pose_app-2.0.4.dist-info → lightning_pose_app-2.0.4.1.dist-info}/METADATA +1 -1
- {lightning_pose_app-2.0.4.dist-info → lightning_pose_app-2.0.4.1.dist-info}/RECORD +7 -6
- litpose_app/main.py +39 -6
- litpose_app/ngdist/ng_app/browser/index.html +1 -0
- litpose_app/rootconfig.py +5 -0
- litpose_app/utils/check_for_upgrade.py +49 -0
- {lightning_pose_app-2.0.4.dist-info → lightning_pose_app-2.0.4.1.dist-info}/WHEEL +0 -0
|
@@ -4,14 +4,14 @@ litpose_app/config_default.yaml,sha256=Dx83muIy0ceqG3xXlwOA17zQME_pVSUY0PBEaio34
|
|
|
4
4
|
litpose_app/config_default_multiview.yaml,sha256=vTEkvrEfcJoOXQJWy9gnTK6U2iBaV9LS1o5OAbTaguo,7883
|
|
5
5
|
litpose_app/datatypes.py,sha256=QIz77uP5dPr0N0DfaLT1KZIjRPzDqWM35i2KyetEUOQ,618
|
|
6
6
|
litpose_app/deps.py,sha256=d_YWr8wE4T4Yv87A92ce5ziPp77eQzk6UbyVpbYxbUs,2628
|
|
7
|
-
litpose_app/main.py,sha256=
|
|
7
|
+
litpose_app/main.py,sha256=qHHA-lUA7B6cR7IWfzzcw7DCKvLVtU-nQyRqJhwQOHg,8527
|
|
8
8
|
litpose_app/ngdist/ng_app/3rdpartylicenses.txt,sha256=xJQdd3vjhodQmCRoPgqCuuLFpmWdo2Fo44IZjz4Jgpk,26440
|
|
9
9
|
litpose_app/ngdist/ng_app/browser/app.component-AUUQIS4L.css.map,sha256=e6lXWzmK3xppKK3tXHUccK1yGZqd1kzyTpDH0F1nC2g,344
|
|
10
10
|
litpose_app/ngdist/ng_app/browser/create-model-dialog.component-XM4MKM6L.css.map,sha256=VoykZn4fCKe9ybsL20I-uR6tCGuxLAO92mFmFcuTphk,385
|
|
11
11
|
litpose_app/ngdist/ng_app/browser/error-dialog.component-HYLQSJEP.css.map,sha256=zJuF-LfB994Y1IrnIz38mariDFb8yucffbWPXgHGbvw,355
|
|
12
12
|
litpose_app/ngdist/ng_app/browser/extract-frames-dialog.component-DKKIPRKS.css.map,sha256=R7j-k-UWnqcy0Lwyrg41j9K1vJ8pdu3g27YzTgvsdLw,397
|
|
13
13
|
litpose_app/ngdist/ng_app/browser/favicon.ico,sha256=QtbXVfx3HI-WqWh_kkBIQyYzJsDmLw_3Y4_UN7pBepE,15406
|
|
14
|
-
litpose_app/ngdist/ng_app/browser/index.html,sha256=
|
|
14
|
+
litpose_app/ngdist/ng_app/browser/index.html,sha256=CMRvb89BaTkkm0EhB8wsdXjBHgjskQMNS7oKzxcbtNU,25799
|
|
15
15
|
litpose_app/ngdist/ng_app/browser/keypoint-container.component-KO24463N.css.map,sha256=pdxBbg2QoKPjtR_DYnJFxIMYZiYz1OQDgrJEItSOAqg,1275
|
|
16
16
|
litpose_app/ngdist/ng_app/browser/keypoint-container.component-SZ5BMRPW.css.map,sha256=jANFxnVymflWlxk76V9WnPEACHDUoPdGTTxNuJErCE8,2022
|
|
17
17
|
litpose_app/ngdist/ng_app/browser/labeler-page.component-QRMYNSCU.css.map,sha256=sVCjR7JatS-3NB9JZMH7l8xR4AuTuJgqLSAm1rvDCt4,212
|
|
@@ -45,7 +45,7 @@ litpose_app/paths/__init__.py,sha256=qVtaWuPqpIaeEZX3cX30eOcWbDmzTe2eTyTGlt7rHSo
|
|
|
45
45
|
litpose_app/paths/path_util.py,sha256=ordQtLrAP7wZxcYhoX9-0jB-3k_qb12K_7HNmry61Oc,1614
|
|
46
46
|
litpose_app/paths/path_util_legacy.py,sha256=5nriPHw6XuUPz1i5oX6gWVTa8PBM1Z9_S7yTumjQwuI,10623
|
|
47
47
|
litpose_app/project.py,sha256=xYzyGxPx948_AtyrJoZBpnLC7KH4t77locFKIvcw-3k,2641
|
|
48
|
-
litpose_app/rootconfig.py,sha256=
|
|
48
|
+
litpose_app/rootconfig.py,sha256=rBjnDa54hml70Esbv1BPfMd4KECjA8cExfwBpvnfY8I,1209
|
|
49
49
|
litpose_app/routes/config_root.py,sha256=qLEBcnovU4RWshTsNbDmJtSsFPjF7WdLCZ99BJ92WIg,534
|
|
50
50
|
litpose_app/routes/configs.py,sha256=Ua3AFQFadYas8i2W_OE2eN10o2EiLk9B518U9nA0dKI,2398
|
|
51
51
|
litpose_app/routes/extract_frames.py,sha256=Xqm6qm-7v-pB82VQdO9dv9bzEEeqgxWdewLR2cvuPM8,4043
|
|
@@ -67,6 +67,7 @@ litpose_app/tasks/extract_frames.py,sha256=5OzKCqwOCAMkjqqjuVw4x96Pqj9UTv8l7ombe
|
|
|
67
67
|
litpose_app/tasks/transcode_fine.py,sha256=OrGH0OA0F8SsN_Aa00hFYg6wEJfQmyuh18dO82VPsOw,3879
|
|
68
68
|
litpose_app/train_scheduler.py,sha256=4q20pUL89XpWnOhuGTzRCF7oe7FS6c2Ykh6qN_xJZh0,9659
|
|
69
69
|
litpose_app/utils/__init__.py,sha256=YW1PsTomhfvpjdA-A5nSzrQfwdYzfizy82N711GlCYg,77
|
|
70
|
+
litpose_app/utils/check_for_upgrade.py,sha256=xcNOnY9WtpdbSIyJXMJ_xTPmzU0TiMos1m55XXC_d30,1554
|
|
70
71
|
litpose_app/utils/enqueue.py,sha256=RqOhL0ObUBmCmlSHHIugDy1-jVOKTfLuqNbIILawxvo,1904
|
|
71
72
|
litpose_app/utils/file_response.py,sha256=Hbh87Upiy0YGe7ioPFoSh5D697HTEWM99-H_A42XSCI,1938
|
|
72
73
|
litpose_app/utils/fix_empty_first_row.py,sha256=34cSDwG4YoAxXUPjDTCcieI-kW8qK8lH8rbZieSN36Q,565
|
|
@@ -74,6 +75,6 @@ litpose_app/utils/mv_label_file.py,sha256=VarVDSF0Rx90WThLZfArS7nmKiGcTmONNWjOGl
|
|
|
74
75
|
litpose_app/utils/video/__init__.py,sha256=dSc-yVjXmn7ajNR7WgkCUUFdn9RLS2NBM2CjH0ePQXE,464
|
|
75
76
|
litpose_app/utils/video/export_frames.py,sha256=kAIqjMarqTe51mJd3jk9xw4MotEUV1UfxtgTepyw2mc,1738
|
|
76
77
|
litpose_app/utils/video/frame_selection.py,sha256=2x_F6Ez7WHDmvC-FeD6lO31kPvG5oRLrDQIhndoRT-g,4736
|
|
77
|
-
lightning_pose_app-2.0.4.dist-info/METADATA,sha256=
|
|
78
|
-
lightning_pose_app-2.0.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
79
|
-
lightning_pose_app-2.0.4.dist-info/RECORD,,
|
|
78
|
+
lightning_pose_app-2.0.4.1.dist-info/METADATA,sha256=CNSoUw9Zghtca3kstKJrMgQou_2lCE2otuJr9Usdmrg,1399
|
|
79
|
+
lightning_pose_app-2.0.4.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
80
|
+
lightning_pose_app-2.0.4.1.dist-info/RECORD,,
|
litpose_app/main.py
CHANGED
|
@@ -9,16 +9,18 @@ from textwrap import dedent
|
|
|
9
9
|
|
|
10
10
|
import anyio
|
|
11
11
|
import uvicorn
|
|
12
|
-
from fastapi import FastAPI, HTTPException, APIRouter, Request
|
|
13
|
-
from fastapi.responses import FileResponse
|
|
12
|
+
from fastapi import FastAPI, HTTPException, APIRouter, Request, Depends
|
|
13
|
+
from fastapi.responses import FileResponse, HTMLResponse
|
|
14
14
|
from starlette import status
|
|
15
15
|
from starlette.responses import Response
|
|
16
16
|
from starlette.staticfiles import StaticFiles
|
|
17
17
|
|
|
18
18
|
from . import deps
|
|
19
|
+
from .rootconfig import RootConfig
|
|
19
20
|
from .routes.labeler.multiview_autolabel import warm_up_anipose
|
|
20
21
|
from .routes.videos import cleanup_old_uploads
|
|
21
22
|
from .train_scheduler import _train_scheduler_process_target
|
|
23
|
+
from .utils.check_for_upgrade import check_for_upgrade
|
|
22
24
|
from .utils.file_response import file_response
|
|
23
25
|
|
|
24
26
|
## Setup logging
|
|
@@ -191,11 +193,42 @@ async def favicon():
|
|
|
191
193
|
|
|
192
194
|
# Catch-all route. serve index.html.
|
|
193
195
|
@app.get("/{full_path:path}")
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
def index(rc: RootConfig = Depends(deps.root_config)):
|
|
197
|
+
index_path = Path(__file__).parent / "ngdist" / "ng_app" / "browser" / "index.html"
|
|
198
|
+
content = index_path.read_text(encoding="utf-8")
|
|
199
|
+
analytics_tag_placeholder = "<!-- ANALYTICS_TAG_PLACEHOLDER -->"
|
|
200
|
+
assert analytics_tag_placeholder in content
|
|
201
|
+
|
|
202
|
+
# Skip analytics tag insertion if DO_NOT_TRACK is set
|
|
203
|
+
import os
|
|
204
|
+
|
|
205
|
+
if os.environ.get("DO_NOT_TRACK") != "1":
|
|
206
|
+
content = content.replace(analytics_tag_placeholder, rc.UMAMI_ANALYTICS_TAG)
|
|
207
|
+
|
|
208
|
+
return HTMLResponse(content=content)
|
|
198
209
|
|
|
199
210
|
|
|
200
211
|
def run_app(host: str, port: int):
|
|
212
|
+
import os
|
|
213
|
+
|
|
214
|
+
if os.environ.get("DO_NOT_TRACK") != "1":
|
|
215
|
+
usage_message = dedent(
|
|
216
|
+
"""
|
|
217
|
+
================================================================================
|
|
218
|
+
📊 Lightning Pose App Usage Tracking
|
|
219
|
+
|
|
220
|
+
To help us improve this tool and secure future grant funding, launching the app
|
|
221
|
+
in your browser will initiate privacy-focused web event tracking. We use Umami,
|
|
222
|
+
which ensures no personal data is ever collected or stored.
|
|
223
|
+
|
|
224
|
+
To opt out, please restart the app with the environment variable DO_NOT_TRACK=1
|
|
225
|
+
For example: DO_NOT_TRACK=1 litpose run_app
|
|
226
|
+
================================================================================
|
|
227
|
+
"""
|
|
228
|
+
)
|
|
229
|
+
print(usage_message, file=sys.stderr)
|
|
230
|
+
else:
|
|
231
|
+
logger.info("App tracking is opted out, skipping analytics tag insertion")
|
|
232
|
+
|
|
233
|
+
check_for_upgrade()
|
|
201
234
|
uvicorn.run(app, host=host, port=port, timeout_graceful_shutdown=1)
|
litpose_app/rootconfig.py
CHANGED
|
@@ -16,6 +16,11 @@ class RootConfig(BaseSettings):
|
|
|
16
16
|
default_factory=lambda data: data["LP_SYSTEM_DIR"] / "uploads"
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
+
UMAMI_ANALYTICS_TAG: str = (
|
|
20
|
+
'<script defer src="https://cloud.umami.is/script.js" '
|
|
21
|
+
'data-website-id="ba9731f2-f746-4c4e-8fc6-d876e1556a6e"></script>'
|
|
22
|
+
)
|
|
23
|
+
|
|
19
24
|
@model_validator(mode="after")
|
|
20
25
|
def init_dirs_and_files(self):
|
|
21
26
|
"""Creates directories as needed on application startup"""
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from textwrap import dedent
|
|
5
|
+
|
|
6
|
+
logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def check_for_upgrade():
|
|
10
|
+
if os.environ.get("LP_IGNORE_UPGRADE") == "1":
|
|
11
|
+
logger.info(f"LP_IGNORE_UPGRADE=1 present, Skipping upgrade check ")
|
|
12
|
+
return
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import urllib.request
|
|
16
|
+
from packaging import version
|
|
17
|
+
import importlib.metadata
|
|
18
|
+
|
|
19
|
+
package_name = "lightning-pose-app"
|
|
20
|
+
try:
|
|
21
|
+
current_version = importlib.metadata.version(package_name)
|
|
22
|
+
# Fetch latest version from PyPI
|
|
23
|
+
with urllib.request.urlopen(
|
|
24
|
+
f"https://pypi.org/pypi/{package_name}/json", timeout=5
|
|
25
|
+
) as response:
|
|
26
|
+
data = json.load(response)
|
|
27
|
+
latest_version = data["info"]["version"]
|
|
28
|
+
|
|
29
|
+
if version.parse(latest_version) > version.parse(current_version):
|
|
30
|
+
print(
|
|
31
|
+
dedent(
|
|
32
|
+
f"""
|
|
33
|
+
{'-' * 80}
|
|
34
|
+
🚀 A new version of {package_name} is available: {latest_version} (current: {current_version})
|
|
35
|
+
|
|
36
|
+
To upgrade, run:
|
|
37
|
+
pip install --upgrade {package_name}
|
|
38
|
+
|
|
39
|
+
To skip this check in the future, use the LP_IGNORE_UPGRADE env variable:
|
|
40
|
+
LP_IGNORE_UPGRADE=1 litpose run_app
|
|
41
|
+
{'-' * 80}
|
|
42
|
+
"""
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
sys.exit(0)
|
|
47
|
+
except Exception as e:
|
|
48
|
+
# Don't block startup if PyPI is down or package isn't installed via pip
|
|
49
|
+
logger.debug(f"Upgrade check failed: {e}")
|
|
File without changes
|