Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Dependabot version updates.
#
# Alerts were already enabled on this repo, but with no config here nothing
# ever opened a PR, so advisories just accumulated (53 open at the time this
# was added). The `dependabot/*` branches on origin are leftovers from an
# older npm-only config and can be deleted.
#
# Minor/patch bumps are grouped into one PR per manifest — the dependency
# trees here are mostly transitive (torch, spacy, HF), so ungrouped updates
# would mean dozens of near-identical PRs. Majors stay separate: plotly,
# smart-open and vite have all needed judgment calls rather than a merge.
version: 2
updates:
- package-ecosystem: "uv"
directory: "/lib"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
groups:
lib-minor-patch:
patterns: ["*"]
update-types: ["minor", "patch"]

- package-ecosystem: "uv"
directory: "/labeler"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
groups:
labeler-minor-patch:
patterns: ["*"]
update-types: ["minor", "patch"]

- package-ecosystem: "npm"
directory: "/web-app/browser-app"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
groups:
browser-app-minor-patch:
patterns: ["*"]
update-types: ["minor", "patch"]
22 changes: 22 additions & 0 deletions api/topologic_bundled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Single-port bundled app for Docker / standalone gunicorn deployments.

The manual-install layout expects a reverse proxy (apache, nginx) to strip
path prefixes before forwarding to the API, so `topologic_explorer:app`
registers its routes at the bare paths (`/get_topic_data/...`, `/{db}/topic/...`).

In the Docker image we run gunicorn directly on :80 with no upstream proxy,
so the request paths arrive un-stripped. This wrapper mounts the same app
twice — once at each external prefix — so:
/topologic-api/get_topic_data/... -> /get_topic_data/...
/topologic/{db}/topic/... -> /{db}/topic/...
both reach the right handlers.
"""
from fastapi import FastAPI

from topologic_explorer import app as base_app

app = FastAPI()
# Order matters: the longer prefix must be registered first so
# `/topologic-api/...` is not captured by the `/topologic` mount.
app.mount("/topologic-api", base_app)
app.mount("/topologic", base_app)
31 changes: 21 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ set -e
# for GPU-accelerated spacy preprocessing).
BACKEND=""
RESTART="yes"
SKIP_LABELER="no"
for arg in "$@"; do
case "$arg" in
--cpu) BACKEND="cpu" ;;
--cuda) BACKEND="cuda" ;;
--no-restart) RESTART="no" ;;
--skip-labeler) SKIP_LABELER="yes" ;;
-h|--help)
echo "Usage: $0 [--cpu | --cuda] [--no-restart]"
echo " --cpu Install CPU-only torch; skip cupy."
echo " --cuda Install CUDA 12.4 torch + cupy-cuda12x for GPU spacy."
echo " (default) Auto-detect: use --cuda if nvidia-smi is on PATH, else --cpu."
echo " --no-restart Do not restart a running API server after installing."
echo "Usage: $0 [--cpu | --cuda] [--no-restart] [--skip-labeler]"
echo " --cpu Install CPU-only torch; skip cupy."
echo " --cuda Install CUDA 12.4 torch + cupy-cuda12x for GPU spacy."
echo " (default) Auto-detect: use --cuda if nvidia-smi is on PATH, else --cpu."
echo " --no-restart Do not restart a running API server after installing."
echo " --skip-labeler Skip the LLM topic-labeler venv (~5GB, a second torch copy)."
echo " Serve-only installs never invoke it; training with"
echo " [TOPIC_LABELING] enabled falls back to top-word labels."
exit 0 ;;
*)
echo "Unknown argument: $arg" >&2
echo "Usage: $0 [--cpu | --cuda] [--no-restart]" >&2
echo "Usage: $0 [--cpu | --cuda] [--no-restart] [--skip-labeler]" >&2
exit 1 ;;
esac
done
Expand Down Expand Up @@ -67,10 +72,16 @@ cp -R lib /var/lib/topologic/lib
# The labeler lives in its own package + venv because it needs a newer
# `transformers` than spacy-transformers allows in the main env. The main
# topologic pipeline shells out to `topologic-labeler` on demand.
rm -rf /var/lib/topologic/labeler
cp -R labeler /var/lib/topologic/labeler
( cd /var/lib/topologic/labeler && UV_PROJECT_ENVIRONMENT=/var/lib/topologic/topologic_labeler_env uv sync --frozen --extra "$BACKEND" )
sudo ln -sf /var/lib/topologic/topologic_labeler_env/bin/topologic-labeler /usr/local/bin/topologic-labeler
# --skip-labeler only declines to install/update it; an existing labeler from a
# previous run is left alone and keeps working.
if [ "$SKIP_LABELER" = "yes" ]; then
echo "Skipping the topic-labeler venv (--skip-labeler)."
else
rm -rf /var/lib/topologic/labeler
cp -R labeler /var/lib/topologic/labeler
( cd /var/lib/topologic/labeler && UV_PROJECT_ENVIRONMENT=/var/lib/topologic/topologic_labeler_env uv sync --frozen --extra "$BACKEND" )
sudo ln -sf /var/lib/topologic/topologic_labeler_env/bin/topologic-labeler /usr/local/bin/topologic-labeler
fi

# Install the topologic script
sudo cp topologic /usr/local/bin/
Expand Down
Loading