aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2025-01-08 21:58:04 -0500
committerAnthony Wang2025-01-08 21:58:04 -0500
commit0e60d73ccf632a5ffa06c36a26b3cd77182a18eb (patch)
treea144e7ae2f1252a867811b283dfbd742ca337ad1
parentc74d9ba868e4681ca5138db35a367642c233d029 (diff)
Change the client entrypoint to run a noop main function to get around module not callable error
-rw-r--r--README.md2
-rw-r--r--pyproject.toml2
-rw-r--r--search/client.py11
-rw-r--r--search/server.py2
4 files changed, 14 insertions, 3 deletions
diff --git a/README.md b/README.md
index bcf0422..81c8252 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Install it using `pipx install git+https://git.unnamed.website/search/` or `uv t
## Usage
-This program uses a client-server architecture to watch directories with inotify and keep the model in memory so the client doesn't have to wait several seconds to load the model. It uses file inodes and modification times to avoid unnecessary re-indexing. Additionally, the client only depends on the Python standard library.
+This program uses a client-server architecture to watch directories with inotify and keep the model in memory so the client doesn't have to wait several seconds to load the model. It uses file inodes and modification times to avoid unnecessary re-indexing.
Run `search-server DIRS_TO_INDEX` to start the server. Make sure you don't include nested directories or weird stuff will happen. The server currently only indexes images although more modalities may be supported in the future. There are probably some weird race condition bugs if you modify a lot of files at the same time.
diff --git a/pyproject.toml b/pyproject.toml
index 59a4c0b..b990617 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -19,7 +19,7 @@ intel-gpu = [
[project.scripts]
search-server = "search:server"
-search-client = "search:client"
+search-client = "search:client.main"
[tool.uv]
package = true
diff --git a/search/client.py b/search/client.py
index e2de8a0..6575f49 100644
--- a/search/client.py
+++ b/search/client.py
@@ -29,3 +29,14 @@ else:
# print(imgpath)
# c = converter.SixelConverter(imgpath, h=50, w=50)
# c.write(sys.stdout)
+
+
+def main():
+ # TODO: This seems like a weird hack
+ # There's got to be a better way to get around the problem
+ # sys.exit(client())
+ # ^^^^^^^^
+ # TypeError: 'module' object is not callable
+ # when I make the entrypoint in pyproject.toml just search:client
+
+ pass
diff --git a/search/server.py b/search/server.py
index 45b5ae3..6719a99 100644
--- a/search/server.py
+++ b/search/server.py
@@ -12,7 +12,7 @@ from platformdirs import PlatformDirs
from watchdog.events import FileOpenedEvent, FileSystemEventHandler
from watchdog.observers import Observer
-from .model import embed_text, embed_image
+from .model import embed_image, embed_text
from .unixsocket import UnixStreamXMLRPCServer
DIM = 768