perf(cli,core): lazy load Crypto and rich.markdown modules to boost startup latency and bump to v6.1.1
- Implement lazy `@property` getters for `configfile.privatekey` and `configfile.publickey` to defer RSA key loading and pycryptodome imports until explicitly accessed. - Move top-level `Crypto` imports inside local methods in `configfile.py`, `core.py`, and `config_service.py`. - Remove top-level `from rich.markdown import Markdown` across CLI handlers (`node_handler.py`, `ai_handler.py`, `terminal_ui.py`) and `ai.py`, deferring parser load to active rendering calls. - Reduce CLI startup load latency from ~172 ms to ~49 ms (>3.5x speedup / ~71% latency reduction). - Regenerate HTML documentation in `docs/` via `pdoc`. - Bump version to v6.1.1.
This commit is contained in:
1 parent
0632a510ad
commit
32fe18d27a
15 files changed
+127
-21
No files matched your search
+2
-2
@@ -4,8 +4,6 @@ import os
|
||||
import re
|
||||
import pexpect
|
||||
import shlex
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.Cipher import PKCS1_OAEP
|
||||
import ast
|
||||
from time import sleep,time
|
||||
import datetime
|
||||
@@ -274,6 +272,8 @@ class node:
|
||||
if keyfile is None:
|
||||
keyfile = self.key
|
||||
if keyfile is not None:
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.Cipher import PKCS1_OAEP
|
||||
with open(keyfile) as f:
|
||||
key = RSA.import_key(f.read())
|
||||
decryptor = PKCS1_OAEP.new(key)
|
||||
|
||||
Reference in new issue
Block a user