flkit 0.1.0__tar.gz → 0.1.2__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 (69) hide show
  1. {flkit-0.1.0 → flkit-0.1.2}/PKG-INFO +1 -1
  2. flkit-0.1.2/pyproject.toml +52 -0
  3. flkit-0.1.2/src/flkit/alg/point_in_volume_rs.pyd +0 -0
  4. flkit-0.1.2/src/flkit/alg/point_in_volume_rs1.pyd +0 -0
  5. flkit-0.1.2/src/flkit/alg/point_in_volume_rs2.pyd +0 -0
  6. flkit-0.1.2/src/flkit/alg/point_in_volume_rs3.pyd +0 -0
  7. flkit-0.1.2/src/flkit/alg/point_to_triangle_rs.pyd +0 -0
  8. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/db/path_utl.py +5 -4
  9. flkit-0.1.2/src/flkit/tools/default_cli_server.py +86 -0
  10. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/webview.py +1 -1
  11. flkit-0.1.0/pyproject.toml +0 -31
  12. {flkit-0.1.0 → flkit-0.1.2}/.python-version +0 -0
  13. {flkit-0.1.0 → flkit-0.1.2}/README.md +0 -0
  14. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/__init__.py +0 -0
  15. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/__init__.py +0 -0
  16. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/build_idx.py +0 -0
  17. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/c_track.py +0 -0
  18. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/collierydb.py +0 -0
  19. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/del2.py +0 -0
  20. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/delaunay_triangulation.py +0 -0
  21. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/finite_plane_distance.py +0 -0
  22. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/get_up_low.py +0 -0
  23. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/in_tin.py +0 -0
  24. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/index.py +0 -0
  25. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/BasePredictor.py +0 -0
  26. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/Kriging.py +0 -0
  27. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/KrigingM.py +0 -0
  28. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/LossFuncs.py +0 -0
  29. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/__init__.py +0 -0
  30. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/idw.py +0 -0
  31. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/midw.py +0 -0
  32. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/nearest_neighbor.py +0 -0
  33. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/rbf.py +0 -0
  34. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/inter/trilinear.py +0 -0
  35. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_in_polygon.py +0 -0
  36. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_in_volume.py +0 -0
  37. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_in_volume_rs.pyi +0 -0
  38. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_to_triangle.py +0 -0
  39. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_to_triangle_mesh.py +0 -0
  40. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/point_to_triangle_rs.pyi +0 -0
  41. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/alg/rotated_rect.py +0 -0
  42. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/db/__init__.py +0 -0
  43. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/db/db_model.py +0 -0
  44. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/db/duck_model.py +0 -0
  45. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/db/fileobj.py +0 -0
  46. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/mtcli/__init__.py +0 -0
  47. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/mtcli/core.py +0 -0
  48. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/mtcli/parse.py +0 -0
  49. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/py.typed +0 -0
  50. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/__init__.py +0 -0
  51. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/del_key.py +0 -0
  52. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/dict_to_list.py +0 -0
  53. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/get_region.py +0 -0
  54. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/max_key.py +0 -0
  55. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/mongo.py +0 -0
  56. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/mt_dash.py +0 -0
  57. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/tools/prase_type.py +0 -0
  58. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/Res.py +0 -0
  59. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/__init__.py +0 -0
  60. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/c_grid.py +0 -0
  61. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/console.py +0 -0
  62. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/engine.py +0 -0
  63. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/getenv.py +0 -0
  64. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/result.py +0 -0
  65. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/table.py +0 -0
  66. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/utils.py +0 -0
  67. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/verify.py +0 -0
  68. {flkit-0.1.0 → flkit-0.1.2}/src/flkit/typr/wstask.py +0 -0
  69. {flkit-0.1.0 → flkit-0.1.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flkit
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: 一个功能强大的 Python 工具包,提供空间分析、数据插值、数据库操作、命令行工具等多种功能
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: click>=8.1.0
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "flkit"
3
+ version = "0.1.2"
4
+ description = "一个功能强大的 Python 工具包,提供空间分析、数据插值、数据库操作、命令行工具等多种功能"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = [
8
+ "duckdb>=1.5.1",
9
+ "fastapi>=0.135.2",
10
+ "matplotlib>=3.10.8",
11
+ "numpy>=2.4.4",
12
+ "opencv-python>=4.13.0.92",
13
+ "pandas>=3.0.1",
14
+ "pykrige>=1.7.3",
15
+ "pymongo>=4.16.0",
16
+ "pyvista>=0.47.1",
17
+ "pyvistaqt>=0.11.3",
18
+ "pywebview>=6.1",
19
+ "scipy>=1.17.1",
20
+ "triangle>=20250106",
21
+ "click>=8.1.0",
22
+ "pexpect>=4.8.0",
23
+ "pydantic>=2.0.0",
24
+ "python-dotenv>=1.0.0",
25
+ "scikit-learn>=1.3.0",
26
+ "requests>=2.31.0",
27
+ ]
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["src/flkit"]
35
+
36
+ [tool.hatch.build.targets.sdist.force-include]
37
+ "src/flkit/alg/point_in_volume_rs.pyd" = "src/flkit/alg/point_in_volume_rs.pyd"
38
+ "src/flkit/alg/point_in_volume_rs1.pyd" = "src/flkit/alg/point_in_volume_rs1.pyd"
39
+ "src/flkit/alg/point_in_volume_rs2.pyd" = "src/flkit/alg/point_in_volume_rs2.pyd"
40
+ "src/flkit/alg/point_in_volume_rs3.pyd" = "src/flkit/alg/point_in_volume_rs3.pyd"
41
+ "src/flkit/alg/point_to_triangle_rs.pyd" = "src/flkit/alg/point_to_triangle_rs.pyd"
42
+ "src/flkit/alg/point_in_volume_rs.pyi" = "src/flkit/alg/point_in_volume_rs.pyi"
43
+ "src/flkit/alg/point_to_triangle_rs.pyi" = "src/flkit/alg/point_to_triangle_rs.pyi"
44
+
45
+ [tool.hatch.build.targets.wheel.force-include]
46
+ "src/flkit/alg/point_in_volume_rs.pyd" = "flkit/alg/point_in_volume_rs.pyd"
47
+ "src/flkit/alg/point_in_volume_rs1.pyd" = "flkit/alg/point_in_volume_rs1.pyd"
48
+ "src/flkit/alg/point_in_volume_rs2.pyd" = "flkit/alg/point_in_volume_rs2.pyd"
49
+ "src/flkit/alg/point_in_volume_rs3.pyd" = "flkit/alg/point_in_volume_rs3.pyd"
50
+ "src/flkit/alg/point_to_triangle_rs.pyd" = "flkit/alg/point_to_triangle_rs.pyd"
51
+ "src/flkit/alg/point_in_volume_rs.pyi" = "flkit/alg/point_in_volume_rs.pyi"
52
+ "src/flkit/alg/point_to_triangle_rs.pyi" = "flkit/alg/point_to_triangle_rs.pyi"
@@ -3,7 +3,6 @@ import os
3
3
  import shutil
4
4
  from pathlib import Path
5
5
  import zipfile
6
- from ..tools import MtDash
7
6
 
8
7
 
9
8
  class PathUtl(Path):
@@ -143,9 +142,11 @@ class PathUtl(Path):
143
142
  def c_parent(self):
144
143
  return self.parent.c()
145
144
 
146
- def zip(self, dst: Path = None, exclude: list[list[str]] = None):
147
- if dst is None:
148
- dst = self.parent / f"{self.name}.zip"
145
+ def zip(self, dst: Path = None, exclude: list[list[str]] = None):
146
+ from ..tools import MtDash
147
+
148
+ if dst is None:
149
+ dst = self.parent / f"{self.name}.zip"
149
150
  exclude = exclude or []
150
151
  with zipfile.ZipFile(dst, "w", zipfile.ZIP_DEFLATED) as zipf:
151
152
  for file in self.rglob("*"):
@@ -0,0 +1,86 @@
1
+ import uuid
2
+ import uvicorn
3
+ import signal
4
+ import sys
5
+ from fastapi import FastAPI, Header, UploadFile, File
6
+ from fastapi.staticfiles import StaticFiles
7
+ from fastapi.middleware.cors import CORSMiddleware
8
+ from fastapi import WebSocket
9
+ import flkit.typr as typr
10
+ import flkit.mtcli as mtcli
11
+ import flkit.db as fdb
12
+
13
+
14
+ def run_default_cli_server(
15
+ cli_obj,
16
+ hook_servers: callable = None,
17
+ port: int = 8083,
18
+ allow_origins: list = ["*"],
19
+ allow_credentials: bool = True,
20
+ allow_methods: list = ["*"],
21
+ allow_headers: list = ["*"],
22
+ ignore_start: bool = True,
23
+ catch_exception: bool = True,
24
+ is_async: bool = False,
25
+ ):
26
+ """运行命令服务器"""
27
+
28
+ base_dir = fdb.PathUtl(__file__).parent
29
+
30
+ typr.load_env(base_dir / ".env")
31
+
32
+ exec_cli = mtcli.client(
33
+ cli_obj,
34
+ ignore_start=ignore_start,
35
+ catch_exception=catch_exception,
36
+ is_async=is_async,
37
+ )
38
+
39
+ app = FastAPI()
40
+
41
+ app.add_middleware(
42
+ CORSMiddleware,
43
+ allow_origins=allow_origins,
44
+ allow_credentials=allow_credentials,
45
+ allow_methods=allow_methods,
46
+ allow_headers=allow_headers,
47
+ )
48
+
49
+ app.mount("/statics", StaticFiles(directory="statics"), name="statics")
50
+
51
+ if hook_servers is not None:
52
+ hook_servers()
53
+
54
+ @app.websocket("/long")
55
+ async def legacy_command_handler(websocket: WebSocket):
56
+ await typr.handle_websocket_connection(websocket, exec_cli)
57
+
58
+ @app.websocket("/wcmd")
59
+ async def legacy_command_handler_once(
60
+ websocket: WebSocket, client_id: str = Header(default=None)
61
+ ):
62
+ await typr.handle_websocket_connection_with_command(
63
+ websocket, exec_cli, client_id, print_command=True
64
+ )
65
+
66
+ @app.post("/uploader")
67
+ def file_uploader(file: UploadFile = File(...)):
68
+ # 保存文件到指定目录
69
+ old_name = file.filename
70
+ new_name = uuid.uuid4().hex + old_name.split(".")[-1]
71
+ with open(f"uploads/{new_name}", "wb") as f:
72
+ f.write(file.file.read())
73
+ return {
74
+ "filename": new_name,
75
+ "url": f"/uploads/{new_name}",
76
+ }
77
+
78
+ def handle_shutdown(sig, frame):
79
+ """关闭服务器"""
80
+ print("正在关闭命令服务器...")
81
+ sys.exit(0)
82
+
83
+ signal.signal(signal.SIGINT, handle_shutdown)
84
+ signal.signal(signal.SIGTERM, handle_shutdown)
85
+
86
+ uvicorn.run(app, host="127.0.0.1", port=port, reload=False)
@@ -1,5 +1,5 @@
1
1
  import json
2
- from ..db import PathUtl
2
+ from ..db.path_utl import PathUtl
3
3
  from pathlib import Path
4
4
  import webview
5
5
  import os
@@ -1,31 +0,0 @@
1
- [project]
2
- name = "flkit"
3
- version = "0.1.0"
4
- description = "一个功能强大的 Python 工具包,提供空间分析、数据插值、数据库操作、命令行工具等多种功能"
5
- readme = "README.md"
6
- requires-python = ">=3.13"
7
- dependencies = [
8
- "duckdb>=1.5.1",
9
- "fastapi>=0.135.2",
10
- "matplotlib>=3.10.8",
11
- "numpy>=2.4.4",
12
- "opencv-python>=4.13.0.92",
13
- "pandas>=3.0.1",
14
- "pykrige>=1.7.3",
15
- "pymongo>=4.16.0",
16
- "pyvista>=0.47.1",
17
- "pyvistaqt>=0.11.3",
18
- "pywebview>=6.1",
19
- "scipy>=1.17.1",
20
- "triangle>=20250106",
21
- "click>=8.1.0",
22
- "pexpect>=4.8.0",
23
- "pydantic>=2.0.0",
24
- "python-dotenv>=1.0.0",
25
- "scikit-learn>=1.3.0",
26
- "requests>=2.31.0",
27
- ]
28
-
29
- [build-system]
30
- requires = ["hatchling"]
31
- build-backend = "hatchling.build"
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
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
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