darabos commited on
Commit
c4e194f
Β·
1 Parent(s): 145d037

Move each package into a separate module. Rename "ops" to "core". Fix test.

Browse files
.gitignore CHANGED
@@ -10,4 +10,5 @@
10
  __pycache__
11
  node_modules
12
  dist
 
13
  *.egg-info
 
10
  __pycache__
11
  node_modules
12
  dist
13
+ build
14
  *.egg-info
README.md CHANGED
@@ -9,7 +9,7 @@ original LynxKite. The primary goals of this rewrite are:
9
 
10
  ## Structure
11
 
12
- - `lynxkite-ops`: Core types and utilities. Depend on this lightweight package if you are writing LynxKite plugins.
13
  - `lynxkite-app`: The LynxKite web application. Install some plugins then run this to use LynxKite.
14
  - `lynxkite-graph-analytics`: Graph analytics plugin. The classical LynxKite experience!
15
  - `lynxkite-pillow`: A simple example plugin.
 
9
 
10
  ## Structure
11
 
12
+ - `lynxkite-core`: Core types and utilities. Depend on this lightweight package if you are writing LynxKite plugins.
13
  - `lynxkite-app`: The LynxKite web application. Install some plugins then run this to use LynxKite.
14
  - `lynxkite-graph-analytics`: Graph analytics plugin. The classical LynxKite experience!
15
  - `lynxkite-pillow`: A simple example plugin.
lynxkite-app/pyproject.toml CHANGED
@@ -6,7 +6,7 @@ readme = "README.md"
6
  requires-python = ">=3.11"
7
  dependencies = [
8
  "fastapi[standard]>=0.115.6",
9
- "lynxkite-ops",
10
  "orjson>=3.10.13",
11
  "pycrdt-websocket>=0.15.3",
12
  "pydantic-to-typescript>=2.0.0",
@@ -14,7 +14,7 @@ dependencies = [
14
  ]
15
 
16
  [tool.uv.sources]
17
- lynxkite-ops = { path = "../lynxkite-ops" }
18
 
19
  [build-system]
20
  requires = ["setuptools", "wheel", "setuptools-scm"]
@@ -25,8 +25,8 @@ namespaces = true
25
  where = ["src"]
26
 
27
  [tool.setuptools.package-data]
28
- "lynxkite.web_assets" = ["*"]
29
- "lynxkite.web_assets.assets" = ["*"]
30
 
31
  [tool.setuptools]
32
  py-modules = ["build_frontend"]
@@ -36,4 +36,4 @@ include-package-data = true
36
  build_py = "build_frontend.build_py"
37
 
38
  [project.scripts]
39
- lynxkite = "lynxkite.__main__:main"
 
6
  requires-python = ">=3.11"
7
  dependencies = [
8
  "fastapi[standard]>=0.115.6",
9
+ "lynxkite-core",
10
  "orjson>=3.10.13",
11
  "pycrdt-websocket>=0.15.3",
12
  "pydantic-to-typescript>=2.0.0",
 
14
  ]
15
 
16
  [tool.uv.sources]
17
+ lynxkite-core = { path = "../lynxkite-core" }
18
 
19
  [build-system]
20
  requires = ["setuptools", "wheel", "setuptools-scm"]
 
25
  where = ["src"]
26
 
27
  [tool.setuptools.package-data]
28
+ "lynxkite.app.web_assets" = ["*"]
29
+ "lynxkite.app.web_assets.assets" = ["*"]
30
 
31
  [tool.setuptools]
32
  py-modules = ["build_frontend"]
 
36
  build_py = "build_frontend.build_py"
37
 
38
  [project.scripts]
39
+ lynxkite = "lynxkite.app.__main__:main"
lynxkite-app/src/build_frontend.py CHANGED
@@ -11,7 +11,7 @@ class build_py(_build_py):
11
  print("\n\nBuilding frontend...", __file__)
12
  here = Path(__file__).parent.parent
13
  frontend_dir = here / "web"
14
- package_dir = here / "src" / "lynxkite" / "web_assets"
15
  subprocess.check_call(["npm", "install"], cwd=frontend_dir)
16
  subprocess.check_call(["npm", "run", "build"], cwd=frontend_dir)
17
  print("files in", frontend_dir / "dist")
 
11
  print("\n\nBuilding frontend...", __file__)
12
  here = Path(__file__).parent.parent
13
  frontend_dir = here / "web"
14
+ package_dir = here / "src" / "lynxkite" / "app" / "web_assets"
15
  subprocess.check_call(["npm", "install"], cwd=frontend_dir)
16
  subprocess.check_call(["npm", "run", "build"], cwd=frontend_dir)
17
  print("files in", frontend_dir / "dist")
lynxkite-app/src/lynxkite/{__init__.py β†’ app/__init__.py} RENAMED
File without changes
lynxkite-app/src/lynxkite/{__main__.py β†’ app/__main__.py} RENAMED
@@ -6,7 +6,7 @@ import os
6
  def main():
7
  port = int(os.environ.get("PORT", "8000"))
8
  reload = bool(os.environ.get("LYNXKITE_RELOAD", ""))
9
- uvicorn.run("lynxkite.main:app", host="0.0.0.0", port=port, reload=reload)
10
 
11
 
12
  if __name__ == "__main__":
 
6
  def main():
7
  port = int(os.environ.get("PORT", "8000"))
8
  reload = bool(os.environ.get("LYNXKITE_RELOAD", ""))
9
+ uvicorn.run("lynxkite.app.main:app", host="0.0.0.0", port=port, reload=reload)
10
 
11
 
12
  if __name__ == "__main__":
lynxkite-app/src/lynxkite/{crdt.py β†’ app/crdt.py} RENAMED
@@ -11,6 +11,7 @@ import pycrdt_websocket
11
  import pycrdt_websocket.ystore
12
  import uvicorn
13
  import builtins
 
14
 
15
  router = fastapi.APIRouter()
16
  DATA_PATH = pathlib.Path.cwd() / "data"
@@ -119,8 +120,6 @@ def crdt_update(crdt_obj, python_obj, boxes=set()):
119
 
120
 
121
  def try_to_load_workspace(ws, name):
122
- from . import workspace
123
-
124
  json_path = f"data/{name}"
125
  if os.path.exists(json_path):
126
  ws_pyd = workspace.load(json_path)
@@ -132,8 +131,6 @@ delayed_executions = {}
132
 
133
 
134
  async def workspace_changed(name, changes, ws_crdt):
135
- from . import workspace
136
-
137
  ws_pyd = workspace.Workspace.model_validate(ws_crdt.to_py())
138
  # Do not trigger execution for superficial changes.
139
  # This is a quick solution until we build proper caching.
@@ -157,8 +154,6 @@ async def workspace_changed(name, changes, ws_crdt):
157
 
158
 
159
  async def execute(name, ws_crdt, ws_pyd, delay=0):
160
- from . import workspace
161
-
162
  if delay:
163
  try:
164
  await asyncio.sleep(delay)
 
11
  import pycrdt_websocket.ystore
12
  import uvicorn
13
  import builtins
14
+ from lynxkite.core import workspace
15
 
16
  router = fastapi.APIRouter()
17
  DATA_PATH = pathlib.Path.cwd() / "data"
 
120
 
121
 
122
  def try_to_load_workspace(ws, name):
 
 
123
  json_path = f"data/{name}"
124
  if os.path.exists(json_path):
125
  ws_pyd = workspace.load(json_path)
 
131
 
132
 
133
  async def workspace_changed(name, changes, ws_crdt):
 
 
134
  ws_pyd = workspace.Workspace.model_validate(ws_crdt.to_py())
135
  # Do not trigger execution for superficial changes.
136
  # This is a quick solution until we build proper caching.
 
154
 
155
 
156
  async def execute(name, ws_crdt, ws_pyd, delay=0):
 
 
157
  if delay:
158
  try:
159
  await asyncio.sleep(delay)
lynxkite-app/src/lynxkite/{main.py β†’ app/main.py} RENAMED
@@ -8,8 +8,8 @@ import pathlib
8
  import pkgutil
9
  from fastapi.staticfiles import StaticFiles
10
  import starlette
11
- from lynxkite import ops
12
- from lynxkite import workspace
13
  from . import crdt
14
 
15
  here = pathlib.Path(__file__).parent
@@ -122,5 +122,5 @@ class SPAStaticFiles(StaticFiles):
122
  raise ex
123
 
124
 
125
- static_dir = SPAStaticFiles(packages=[("lynxkite", "web_assets")], html=True)
126
  app.mount("/", static_dir, name="web_assets")
 
8
  import pkgutil
9
  from fastapi.staticfiles import StaticFiles
10
  import starlette
11
+ from lynxkite.core import ops
12
+ from lynxkite.core import workspace
13
  from . import crdt
14
 
15
  here = pathlib.Path(__file__).parent
 
122
  raise ex
123
 
124
 
125
+ static_dir = SPAStaticFiles(packages=[("lynxkite.app", "web_assets")], html=True)
126
  app.mount("/", static_dir, name="web_assets")
lynxkite-app/src/lynxkite/{web_assets β†’ app/web_assets}/__init__.py RENAMED
File without changes
lynxkite-app/src/lynxkite/{web_assets β†’ app/web_assets}/assets/__init__.py RENAMED
File without changes
lynxkite-app/uv.lock CHANGED
@@ -209,7 +209,7 @@ wheels = [
209
  [[package]]
210
  name = "lynxkite"
211
  version = "0.1.0"
212
- source = { virtual = "." }
213
  dependencies = [
214
  { name = "fastapi", extra = ["standard"] },
215
  { name = "lynxkite-ops" },
 
209
  [[package]]
210
  name = "lynxkite"
211
  version = "0.1.0"
212
+ source = { editable = "." }
213
  dependencies = [
214
  { name = "fastapi", extra = ["standard"] },
215
  { name = "lynxkite-ops" },
{lynxkite-ops β†’ lynxkite-core}/README.md RENAMED
File without changes
{lynxkite-ops β†’ lynxkite-core}/build/lib/lynxkite/executors/one_by_one.py RENAMED
File without changes
{lynxkite-ops β†’ lynxkite-core}/build/lib/lynxkite/ops.py RENAMED
File without changes
{lynxkite-ops β†’ lynxkite-core}/build/lib/lynxkite/workspace.py RENAMED
File without changes
{lynxkite-ops β†’ lynxkite-core}/pyproject.toml RENAMED
@@ -1,5 +1,5 @@
1
  [project]
2
- name = "lynxkite-ops"
3
  version = "0.1.0"
4
  description = "A lightweight dependency for authoring LynxKite operations and executors"
5
  readme = "README.md"
 
1
  [project]
2
+ name = "lynxkite-core"
3
  version = "0.1.0"
4
  description = "A lightweight dependency for authoring LynxKite operations and executors"
5
  readme = "README.md"
{lynxkite-ops/src/lynxkite β†’ lynxkite-core/src/lynxkite/core}/executors/one_by_one.py RENAMED
File without changes
{lynxkite-ops/src/lynxkite β†’ lynxkite-core/src/lynxkite/core}/ops.py RENAMED
File without changes
{lynxkite-ops/src/lynxkite β†’ lynxkite-core/src/lynxkite/core}/workspace.py RENAMED
File without changes
lynxkite-graph-analytics/pyproject.toml CHANGED
@@ -5,11 +5,11 @@ description = "The graph analytics executor and boxes for LynxKite"
5
  readme = "README.md"
6
  requires-python = ">=3.11"
7
  dependencies = [
8
- "lynxkite-ops",
9
  "networkx>=3.4.2",
10
  "pandas>=2.2.3",
11
  "polars[gpu]>=1.14.0",
12
  ]
13
 
14
  [tool.uv.sources]
15
- lynxkite-ops = { path = "../lynxkite-ops" }
 
5
  readme = "README.md"
6
  requires-python = ">=3.11"
7
  dependencies = [
8
+ "lynxkite-core",
9
  "networkx>=3.4.2",
10
  "pandas>=2.2.3",
11
  "polars[gpu]>=1.14.0",
12
  ]
13
 
14
  [tool.uv.sources]
15
+ lynxkite-core = { path = "../lynxkite-core" }
lynxkite-graph-analytics/uv.lock CHANGED
@@ -79,7 +79,7 @@ name = "lynxkite-graph-analytics"
79
  version = "0.1.0"
80
  source = { virtual = "." }
81
  dependencies = [
82
- { name = "lynxkite-ops" },
83
  { name = "networkx" },
84
  { name = "pandas" },
85
  { name = "polars", extra = ["gpu"] },
@@ -87,16 +87,16 @@ dependencies = [
87
 
88
  [package.metadata]
89
  requires-dist = [
90
- { name = "lynxkite-ops", virtual = "../lynxkite-ops" },
91
  { name = "networkx", specifier = ">=3.4.2" },
92
  { name = "pandas", specifier = ">=2.2.3" },
93
  { name = "polars", extras = ["gpu"], specifier = ">=1.14.0" },
94
  ]
95
 
96
  [[package]]
97
- name = "lynxkite-ops"
98
  version = "0.1.0"
99
- source = { virtual = "../lynxkite-ops" }
100
 
101
  [[package]]
102
  name = "networkx"
 
79
  version = "0.1.0"
80
  source = { virtual = "." }
81
  dependencies = [
82
+ { name = "lynxkite-core" },
83
  { name = "networkx" },
84
  { name = "pandas" },
85
  { name = "polars", extra = ["gpu"] },
 
87
 
88
  [package.metadata]
89
  requires-dist = [
90
+ { name = "lynxkite-core", virtual = "../lynxkite-core" },
91
  { name = "networkx", specifier = ">=3.4.2" },
92
  { name = "pandas", specifier = ">=2.2.3" },
93
  { name = "polars", extras = ["gpu"], specifier = ">=1.14.0" },
94
  ]
95
 
96
  [[package]]
97
+ name = "lynxkite-core"
98
  version = "0.1.0"
99
+ source = { virtual = "../lynxkite-core" }
100
 
101
  [[package]]
102
  name = "networkx"
lynxkite-pillow/pyproject.toml CHANGED
@@ -5,9 +5,9 @@ description = "An example LynxKite plugin that wraps some Pillow image processin
5
  readme = "README.md"
6
  requires-python = ">=3.11"
7
  dependencies = [
8
- "lynxkite-ops",
9
  "pillow>=11.1.0",
10
  ]
11
 
12
  [tool.uv.sources]
13
- lynxkite-ops = { path = "../lynxkite-ops" }
 
5
  readme = "README.md"
6
  requires-python = ">=3.11"
7
  dependencies = [
8
+ "lynxkite-core",
9
  "pillow>=11.1.0",
10
  ]
11
 
12
  [tool.uv.sources]
13
+ lynxkite-core = { path = "../lynxkite-core" }
lynxkite-pillow/uv.lock CHANGED
@@ -2,22 +2,22 @@ version = 1
2
  requires-python = ">=3.11"
3
 
4
  [[package]]
5
- name = "lynxkite-ops"
6
  version = "0.1.0"
7
- source = { virtual = "../lynxkite-ops" }
8
 
9
  [[package]]
10
  name = "lynxkite-pillow"
11
  version = "0.1.0"
12
  source = { virtual = "." }
13
  dependencies = [
14
- { name = "lynxkite-ops" },
15
  { name = "pillow" },
16
  ]
17
 
18
  [package.metadata]
19
  requires-dist = [
20
- { name = "lynxkite-ops", virtual = "../lynxkite-ops" },
21
  { name = "pillow", specifier = ">=11.1.0" },
22
  ]
23
 
 
2
  requires-python = ">=3.11"
3
 
4
  [[package]]
5
+ name = "lynxkite-core"
6
  version = "0.1.0"
7
+ source = { virtual = "../lynxkite-core" }
8
 
9
  [[package]]
10
  name = "lynxkite-pillow"
11
  version = "0.1.0"
12
  source = { virtual = "." }
13
  dependencies = [
14
+ { name = "lynxkite-core" },
15
  { name = "pillow" },
16
  ]
17
 
18
  [package.metadata]
19
  requires-dist = [
20
+ { name = "lynxkite-core", virtual = "../lynxkite-core" },
21
  { name = "pillow", specifier = ">=11.1.0" },
22
  ]
23