darabos commited on
Commit
bb9da0e
·
unverified ·
2 Parent(s): f2dea93 211fa36

Merge pull request #88 from biggraph/darabos-hf-spaces

Browse files
.dockerignore ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .venv
2
+ .vscode/*
3
+ !.vscode/extensions.json
4
+ !.vscode/settings.json
5
+ .idea
6
+ .DS_Store
7
+ *.suo
8
+ *.ntvs*
9
+ *.njsproj
10
+ *.sln
11
+ *.sw?
12
+ __pycache__
13
+ node_modules
14
+ dist
15
+ build
16
+ joblib-cache
17
+ *.egg-info
18
+
19
+ lynxkite_crdt_data
20
+
21
+ # Playwright
22
+ test-results
23
+ playwright-report
24
+ /blob-report/
25
+ /playwright/.cache/
.gitignore CHANGED
@@ -1,3 +1,4 @@
 
1
  .vscode/*
2
  !.vscode/extensions.json
3
  !.vscode/settings.json
@@ -18,7 +19,7 @@ joblib-cache
18
  lynxkite_crdt_data
19
 
20
  # Playwright
21
- /test-results/
22
- /playwright-report/
23
  /blob-report/
24
  /playwright/.cache/
 
1
+ .venv
2
  .vscode/*
3
  !.vscode/extensions.json
4
  !.vscode/settings.json
 
19
  lynxkite_crdt_data
20
 
21
  # Playwright
22
+ test-results
23
+ playwright-report
24
  /blob-report/
25
  /playwright/.cache/
.pre-commit-config.yaml CHANGED
@@ -1,12 +1,12 @@
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.5.0
4
  hooks:
5
  - id: trailing-whitespace
6
  - id: end-of-file-fixer
7
  - id: check-yaml
8
  - repo: https://github.com/astral-sh/ruff-pre-commit
9
- rev: v0.9.6
10
  hooks:
11
  - id: ruff
12
  args: [ --fix ]
 
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
  hooks:
5
  - id: trailing-whitespace
6
  - id: end-of-file-fixer
7
  - id: check-yaml
8
  - repo: https://github.com/astral-sh/ruff-pre-commit
9
+ rev: v0.9.10
10
  hooks:
11
  - id: ruff
12
  args: [ --fix ]
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22
2
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3
+ RUN apt-get update && apt-get install -y git
4
+ USER node
5
+ ENV HOME=/home/node PATH=/home/node/.local/bin:$PATH
6
+ WORKDIR $HOME/app
7
+ COPY --chown=node . $HOME/app
8
+ RUN uv venv && uv pip install \
9
+ -e lynxkite-core \
10
+ -e lynxkite-app \
11
+ -e lynxkite-graph-analytics \
12
+ -e lynxkite-bio \
13
+ -e lynxkite-pillow-example
14
+ ENV LYNXKITE_DATA=examples
15
+ ENV PORT=7860
16
+ CMD ["uv", "run", "lynxkite"]
README.md CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  # LynxKite 2024
2
 
3
  This is an experimental rewrite of [LynxKite](https://github.com/lynxkite/lynxkite). It is not compatible with the
 
1
+ ---
2
+ title: LynxKite 2000:MM
3
+ emoji: 🪁
4
+ colorFrom: purple
5
+ colorTo: gray
6
+ sdk: docker
7
+ app_port: 7860
8
+ ---
9
+
10
  # LynxKite 2024
11
 
12
  This is an experimental rewrite of [LynxKite](https://github.com/lynxkite/lynxkite). It is not compatible with the
lynxkite-app/src/lynxkite_app/__main__.py CHANGED
@@ -12,6 +12,7 @@ def main():
12
  port=port,
13
  reload=reload,
14
  loop="asyncio",
 
15
  )
16
 
17
 
 
12
  port=port,
13
  reload=reload,
14
  loop="asyncio",
15
+ proxy_headers=True,
16
  )
17
 
18
 
lynxkite-app/src/lynxkite_app/main.py CHANGED
@@ -7,6 +7,7 @@ import importlib
7
  import pathlib
8
  import pkgutil
9
  from fastapi.staticfiles import StaticFiles
 
10
  import starlette
11
  from lynxkite.core import ops
12
  from lynxkite.core import workspace
@@ -28,6 +29,7 @@ lynxkite_plugins = detect_plugins()
28
 
29
  app = fastapi.FastAPI(lifespan=crdt.lifespan)
30
  app.include_router(crdt.router)
 
31
 
32
 
33
  @app.get("/api/catalog")
 
7
  import pathlib
8
  import pkgutil
9
  from fastapi.staticfiles import StaticFiles
10
+ from fastapi.middleware.gzip import GZipMiddleware
11
  import starlette
12
  from lynxkite.core import ops
13
  from lynxkite.core import workspace
 
29
 
30
  app = fastapi.FastAPI(lifespan=crdt.lifespan)
31
  app.include_router(crdt.router)
32
+ app.add_middleware(GZipMiddleware)
33
 
34
 
35
  @app.get("/api/catalog")
lynxkite-app/web/src/Directory.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import { useState } from "react";
2
  // The directory browser.
3
- import { useNavigate, useParams } from "react-router";
4
  import useSWR from "swr";
5
  import type { DirectoryEntry } from "./apiTypes.ts";
6
 
@@ -23,7 +23,9 @@ const fetcher = (url: string) => fetch(url).then((res) => res.json());
23
  export default function () {
24
  const { path } = useParams();
25
  const encodedPath = encodeURIComponent(path || "");
26
- const list = useSWR(`/api/dir/list?path=${encodedPath}`, fetcher);
 
 
27
  const navigate = useNavigate();
28
  const [isCreatingDir, setIsCreatingDir] = useState(false);
29
  const [isCreatingWorkspace, setIsCreatingWorkspace] = useState(false);
@@ -173,19 +175,19 @@ export default function () {
173
 
174
  {path && (
175
  <div className="breadcrumbs">
176
- <a href="/dir/">
177
  <Home />
178
- </a>{" "}
179
  <span className="current-folder">{path}</span>
180
  </div>
181
  )}
182
 
183
  {list.data.map((item: DirectoryEntry) => (
184
  <div key={item.name} className="entry">
185
- <a key={link(item)} href={link(item)}>
186
  {item.type === "directory" ? <Folder /> : <File />}
187
  {shortName(item)}
188
- </a>
189
  <button
190
  type="button"
191
  onClick={() => {
 
1
  import { useState } from "react";
2
  // The directory browser.
3
+ import { Link, useNavigate, useParams } from "react-router";
4
  import useSWR from "swr";
5
  import type { DirectoryEntry } from "./apiTypes.ts";
6
 
 
23
  export default function () {
24
  const { path } = useParams();
25
  const encodedPath = encodeURIComponent(path || "");
26
+ const list = useSWR(`/api/dir/list?path=${encodedPath}`, fetcher, {
27
+ dedupingInterval: 0,
28
+ });
29
  const navigate = useNavigate();
30
  const [isCreatingDir, setIsCreatingDir] = useState(false);
31
  const [isCreatingWorkspace, setIsCreatingWorkspace] = useState(false);
 
175
 
176
  {path && (
177
  <div className="breadcrumbs">
178
+ <Link to="/dir/">
179
  <Home />
180
+ </Link>{" "}
181
  <span className="current-folder">{path}</span>
182
  </div>
183
  )}
184
 
185
  {list.data.map((item: DirectoryEntry) => (
186
  <div key={item.name} className="entry">
187
+ <Link key={link(item)} to={link(item)}>
188
  {item.type === "directory" ? <Folder /> : <File />}
189
  {shortName(item)}
190
+ </Link>
191
  <button
192
  type="button"
193
  onClick={() => {
lynxkite-app/web/src/workspace/Workspace.tsx CHANGED
@@ -66,8 +66,9 @@ function LynxKiteFlow() {
66
  const state = syncedStore({ workspace: {} as Workspace });
67
  setState(state);
68
  const doc = getYjsDoc(state);
 
69
  const wsProvider = new WebsocketProvider(
70
- `ws://${location.host}/ws/crdt`,
71
  path!,
72
  doc,
73
  );
 
66
  const state = syncedStore({ workspace: {} as Workspace });
67
  setState(state);
68
  const doc = getYjsDoc(state);
69
+ const proto = location.protocol === "https:" ? "wss:" : "ws:";
70
  const wsProvider = new WebsocketProvider(
71
+ `${proto}//${location.host}/ws/crdt`,
72
  path!,
73
  doc,
74
  );
lynxkite-bio/src/lynxkite_bio/__init__.py CHANGED
@@ -10,7 +10,7 @@ import rdkit.Chem.rdFingerprintGenerator
10
  import rdkit.Chem.Fingerprints.ClusterMols
11
  import scipy
12
 
13
- mem = joblib.Memory("../joblib-cache")
14
  ENV = "LynxKite Graph Analytics"
15
  op = ops.op_registration(ENV)
16
 
 
10
  import rdkit.Chem.Fingerprints.ClusterMols
11
  import scipy
12
 
13
+ mem = joblib.Memory("joblib-cache")
14
  ENV = "LynxKite Graph Analytics"
15
  op = ops.op_registration(ENV)
16
 
lynxkite-graph-analytics/src/lynxkite_graph_analytics/bionemo_ops.py CHANGED
@@ -40,7 +40,7 @@ from bionemo.scdl.io.single_cell_collection import SingleCellCollection
40
  import scanpy
41
 
42
 
43
- mem = joblib.Memory("../joblib-cache")
44
  op = ops.op_registration(core.ENV)
45
  DATA_PATH = Path("/workspace")
46
 
 
40
  import scanpy
41
 
42
 
43
+ mem = joblib.Memory("joblib-cache")
44
  op = ops.op_registration(core.ENV)
45
  DATA_PATH = Path("/workspace")
46
 
lynxkite-graph-analytics/src/lynxkite_graph_analytics/lynxkite_ops.py CHANGED
@@ -15,7 +15,7 @@ import polars as pl
15
  import json
16
 
17
 
18
- mem = joblib.Memory("../joblib-cache")
19
  op = ops.op_registration(core.ENV)
20
 
21
 
 
15
  import json
16
 
17
 
18
+ mem = joblib.Memory("joblib-cache")
19
  op = ops.op_registration(core.ENV)
20
 
21