labull-framework 0.1.28__tar.gz → 0.1.30__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.
- {labull_framework-0.1.28/labull_framework.egg-info → labull_framework-0.1.30}/PKG-INFO +1 -1
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/gitinfo.py +73 -5
- {labull_framework-0.1.28 → labull_framework-0.1.30/labull_framework.egg-info}/PKG-INFO +1 -1
- {labull_framework-0.1.28 → labull_framework-0.1.30}/pyproject.toml +1 -1
- {labull_framework-0.1.28 → labull_framework-0.1.30}/LICENSE +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/MANIFEST.in +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/README-pypi.md +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/admin.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/apps.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/auth/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/auth/backend.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/auth/bootstrap.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/auth/sso.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/auth/views.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/data.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/shape_ast.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/canvas.css +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/canvas.js +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/page.html +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/views.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/env.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/jsonio.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/blockpackage.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/deepcheck.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/devkit.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/dispatch.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/export.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/health.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/parallel.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/registry.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/sdk.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/service.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/validate.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/views.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/management/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/management/commands/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/management/commands/labull_contract.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/0001_initial.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/0002_remove_magicblock_prev_files_and_more.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/0003_magicblock_tags.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/0004_magicblock_detail.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/__init__.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/models.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/settings.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/urls.py +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework.egg-info/SOURCES.txt +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework.egg-info/dependency_links.txt +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework.egg-info/requires.txt +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework.egg-info/top_level.txt +0 -0
- {labull_framework-0.1.28 → labull_framework-0.1.30}/setup.cfg +0 -0
|
@@ -53,8 +53,10 @@ _DERIVED_CACHE: dict[tuple[str, str, str], list[dict[str, Any]] | None] = {}
|
|
|
53
53
|
#: 而一份基线要问三次(仓库根、HEAD、HEAD~1)⇒ 光"问路"就 120ms。
|
|
54
54
|
#: 缓存了"算出来的表"却没缓存"问路"的话,第二次请求照样要起三个进程 ——
|
|
55
55
|
#: 那正是"缓存最没用的写法"(真量过:冷 92ms / 热 96ms,等于没缓存)。
|
|
56
|
-
#: ⚠️ 失效靠 `_sources_state()`(项目 `settings.py` +
|
|
57
|
-
#:
|
|
56
|
+
#: ⚠️ 失效靠 `_sources_state()`(项目 `settings.py` + **项目那个 `.git` 的元数据** +
|
|
57
|
+
#: 本模块与 `shape_ast.py` 的 mtime):换了仓库 / 新提交 / 改了这一层的代码都会当场重算,
|
|
58
|
+
#: 见 `_memo()` 与 `_git_state()`。🔴 后面那两项**一样都不能省** —— 少了 `.git` 那一项,
|
|
59
|
+
#: "刚提交完"与"刚把项目纳入版本控制"这两件事在这一层是**看不见**的(真踩过,见 `_sources_state()`)。
|
|
58
60
|
_MEMO: dict[str, Any] = {'state': None, 'values': {}}
|
|
59
61
|
|
|
60
62
|
|
|
@@ -313,12 +315,18 @@ def _revision_tables() -> list[dict[str, Any]] | None:
|
|
|
313
315
|
def _sources_state() -> float:
|
|
314
316
|
"""这一层的输入**现在的**状态(拿不到任何文件时回 `0.0`)。
|
|
315
317
|
|
|
316
|
-
🔴
|
|
318
|
+
🔴 **四个东西都要算进来**,缺一个就有一类"改了没生效":
|
|
317
319
|
· 项目那份 `settings.py`(`INSTALLED_APPS` / `AUTH_USER_MODEL` 从它来)—— 换了它就换了输入;
|
|
318
320
|
· **本模块和 `shape_ast.py` 自己**的 mtime —— 改了"怎么算基线"的代码而缓存不失效,
|
|
319
321
|
症状是"代码明明改了、量到的还是旧结果"(开发这一层时必踩;真踩过,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
为了一个已经修掉的假差异查了半小时,而进程里的缓存还捧着旧的那份);
|
|
323
|
+
· 🔴 **项目那个 `.git` 的元数据**(见 `_git_state()`)—— `git init` / `git commit` /
|
|
324
|
+
切分支**一个字都不动上面那几份文件**,而它们恰好把"仓库根 / 基线那一版"整个换掉。
|
|
325
|
+
少了这一项的症状:**提交完(或者刚把项目纳入版本控制)画布还捧着旧那一版,
|
|
326
|
+
而且同一个进程里永远不会自己好**。真踩过:`tools/sdk-check-py.mjs` 里那条
|
|
327
|
+
"实例属性引用了已删字段"的夹具先问了一次 `shape()`(那时项目还不是仓库)、
|
|
328
|
+
再 `git init` + 提交契约 ⇒ 基线被记忆成 `None`,5 条断言全红。
|
|
329
|
+
⚠️ 基线里的**源码**不用管:它在 git 里,由提交号管 —— 这里看的是 `.git` 自己的元数据。
|
|
322
330
|
"""
|
|
323
331
|
base = _root()
|
|
324
332
|
newest = 0.0
|
|
@@ -330,6 +338,7 @@ def _sources_state() -> float:
|
|
|
330
338
|
newest = max(newest, path.stat().st_mtime)
|
|
331
339
|
except OSError:
|
|
332
340
|
continue
|
|
341
|
+
newest = max(newest, _git_state(base))
|
|
333
342
|
here = Path(__file__).resolve().parent
|
|
334
343
|
for name in ('gitinfo.py', 'shape_ast.py'):
|
|
335
344
|
try:
|
|
@@ -339,6 +348,65 @@ def _sources_state() -> float:
|
|
|
339
348
|
return newest
|
|
340
349
|
|
|
341
350
|
|
|
351
|
+
def _newest_mtime(path: Path) -> float:
|
|
352
|
+
"""这个路径(文件就自己,目录就**递归**)里最新的 mtime(拿不到回 `0.0`)。
|
|
353
|
+
|
|
354
|
+
⚠️ 只对**小的那几棵**目录树用它(`refs` / `logs`,一个仓库几十个文件)。
|
|
355
|
+
**不要拿它去递归 `.git` 自己**:那底下有 `objects/`,一个仓库几千上万个对象 ——
|
|
356
|
+
真踩过:这一层是每次访问缓存都要走的,递归一遍 `.git` 让"热"的那次从 1ms 涨到 340ms,
|
|
357
|
+
`tools/baseline-cases.py` 里那条"第二次走缓存"的判据当场就红了。
|
|
358
|
+
"""
|
|
359
|
+
try:
|
|
360
|
+
newest = path.stat().st_mtime
|
|
361
|
+
except OSError:
|
|
362
|
+
return 0.0
|
|
363
|
+
if path.is_dir():
|
|
364
|
+
for child in path.rglob('*'):
|
|
365
|
+
try:
|
|
366
|
+
newest = max(newest, child.stat().st_mtime)
|
|
367
|
+
except OSError:
|
|
368
|
+
continue
|
|
369
|
+
return newest
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _git_state(base: Path | None) -> float:
|
|
373
|
+
"""项目**最近那个** `.git` 里,"一变就该重算"的东西的最新 mtime(没有 git 回 `0.0`)。
|
|
374
|
+
|
|
375
|
+
🔴 为什么是 `stat` 而不是 `git rev-parse`:`_sources_state()` 每次访问缓存都要问一遍 ——
|
|
376
|
+
起进程就等于把这一层"记忆化"的意义抹掉(那正是它存在的理由,见 `_MEMO` 那段)。
|
|
377
|
+
🔴 走法照 git 自己:从项目根往上找**第一个** `.git`(目录,或 worktree / submodule 那种
|
|
378
|
+
文件)。一个都没有 ⇒ `0.0`("这个项目不受版本控制"也是**一种状态**,一样要能变)。
|
|
379
|
+
🔴 要看的几样各有分工,少一样就有一类"做了那个动作而画布不动":
|
|
380
|
+
· `.git` 自己 + `HEAD` —— `git init` / 切分支 / detach / 换仓库根;
|
|
381
|
+
· `index` —— `git add`;
|
|
382
|
+
· `refs/**` 与 `logs` —— **提交**(⚠️ 只看 `refs` 目录的 mtime **不够**:
|
|
383
|
+
改一个已经存在的 ref 文件不会让目录的 mtime 变),所以这两棵小树递归;
|
|
384
|
+
· `packed-refs` —— 打包过的仓库(`git gc` / 服务器上克隆下来的)。
|
|
385
|
+
⚠️ 只看**最近那个** `.git`(不把上层的也叠进来):git 自己就是这么判"这个目录属于哪个仓库"的,
|
|
386
|
+
叠上来会让"在外层仓库里新 init 一个"这种变化被别的仓库的活动搅浑。
|
|
387
|
+
"""
|
|
388
|
+
if base is None:
|
|
389
|
+
return 0.0
|
|
390
|
+
here = Path(base).resolve()
|
|
391
|
+
while True:
|
|
392
|
+
git = here / '.git'
|
|
393
|
+
if git.exists():
|
|
394
|
+
newest = 0.0
|
|
395
|
+
# ⚠️ 这几个**只 stat 自己**(`git` 只 stat 目录本身,别递归 —— 见 `_newest_mtime()`)。
|
|
396
|
+
for path in (git, git / 'HEAD', git / 'index', git / 'packed-refs'):
|
|
397
|
+
try:
|
|
398
|
+
newest = max(newest, path.stat().st_mtime)
|
|
399
|
+
except OSError:
|
|
400
|
+
continue
|
|
401
|
+
for path in (git / 'refs', git / 'logs'):
|
|
402
|
+
newest = max(newest, _newest_mtime(path))
|
|
403
|
+
return newest
|
|
404
|
+
parent = here.parent
|
|
405
|
+
if parent == here: # 到盘符根了,还没找到仓库
|
|
406
|
+
return 0.0
|
|
407
|
+
here = parent
|
|
408
|
+
|
|
409
|
+
|
|
342
410
|
def _group_apps(files: list[tuple[str, str, str]]) -> dict[str, dict[str, str]]:
|
|
343
411
|
"""把"仓库里的文件"归到各个 app 名下(`shape_ast.derive()` 的入参形态)。
|
|
344
412
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "labull-framework"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.30"
|
|
8
8
|
description = "Labull Framework: a pluggable Django app with Authing OIDC login and magic blocks"
|
|
9
9
|
readme = "README-pypi.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/canvas.css
RENAMED
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/canvas.js
RENAMED
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/canvas/static/page.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/__init__.py
RENAMED
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/blockpackage.py
RENAMED
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/deepcheck.py
RENAMED
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/dispatch.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/parallel.py
RENAMED
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/registry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/magic_block/validate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/management/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework/migrations/0001_initial.py
RENAMED
|
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
|
{labull_framework-0.1.28 → labull_framework-0.1.30}/labull_framework.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|