cocoindex 0.1.61__pp311-pypy311_pp73-manylinux_2_28_aarch64.whl → 0.1.63__pp311-pypy311_pp73-manylinux_2_28_aarch64.whl

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.
cocoindex/cli.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import atexit
2
+ import asyncio
2
3
  import datetime
3
4
  import importlib.util
4
5
  import os
@@ -18,6 +19,7 @@ from rich.table import Table
18
19
 
19
20
  from . import flow, lib, setting
20
21
  from .setup import flow_names_with_setup
22
+ from .runtime import execution_context
21
23
 
22
24
  # Create ServerSettings lazily upon first call, as environment variables may be loaded from files, etc.
23
25
  COCOINDEX_HOST = "https://cocoindex.io"
@@ -267,6 +269,21 @@ def _setup_flows(
267
269
  setup_bundle.apply(report_to_stdout=not quiet)
268
270
 
269
271
 
272
+ def _show_no_live_update_hint() -> None:
273
+ click.secho(
274
+ "NOTE: No change capture mechanism exists. See https://cocoindex.io/docs/core/flow_methods#live-update for more details.\n",
275
+ fg="yellow",
276
+ )
277
+
278
+
279
+ async def _update_all_flows_with_hint_async(
280
+ options: flow.FlowLiveUpdaterOptions,
281
+ ) -> None:
282
+ await flow.update_all_flows_async(options)
283
+ if options.live_mode:
284
+ _show_no_live_update_hint()
285
+
286
+
270
287
  @cli.command()
271
288
  @click.argument("app_target", type=str)
272
289
  @click.option(
@@ -398,7 +415,7 @@ def update(
398
415
  setup: bool, # pylint: disable=redefined-outer-name
399
416
  force: bool,
400
417
  quiet: bool,
401
- ) -> Any:
418
+ ) -> None:
402
419
  """
403
420
  Update the index to reflect the latest data from data sources.
404
421
 
@@ -408,6 +425,12 @@ def update(
408
425
  app_ref, flow_name = _parse_app_flow_specifier(app_flow_specifier)
409
426
  _load_user_app(app_ref)
410
427
 
428
+ if live:
429
+ click.secho(
430
+ "NOTE: Flow code changes will NOT be reflected until you restart to load the new code.\n",
431
+ fg="yellow",
432
+ )
433
+
411
434
  options = flow.FlowLiveUpdaterOptions(live_mode=live, print_stats=not quiet)
412
435
  if flow_name is None:
413
436
  if setup:
@@ -416,14 +439,15 @@ def update(
416
439
  force=force,
417
440
  quiet=quiet,
418
441
  )
419
- return flow.update_all_flows(options)
442
+ execution_context.run(_update_all_flows_with_hint_async(options))
420
443
  else:
421
444
  fl = flow.flow_by_name(flow_name)
422
445
  if setup:
423
446
  _setup_flows((fl,), force=force, quiet=quiet)
424
447
  with flow.FlowLiveUpdater(fl, options) as updater:
425
448
  updater.wait()
426
- return updater.update_stats()
449
+ if options.live_mode:
450
+ _show_no_live_update_hint()
427
451
 
428
452
 
429
453
  @cli.command()
@@ -597,6 +621,10 @@ def server(
597
621
  ),
598
622
  )
599
623
  else:
624
+ click.secho(
625
+ "NOTE: Flow code changes will NOT be reflected until you restart to load the new code. Use --reload to enable auto-reload.\n",
626
+ fg="yellow",
627
+ )
600
628
  _run_server(*args)
601
629
 
602
630
 
@@ -633,9 +661,6 @@ def _run_server(
633
661
  if address is not None:
634
662
  server_settings.address = address
635
663
 
636
- if COCOINDEX_HOST in cors_origins:
637
- click.echo(f"Open CocoInsight at: {COCOINDEX_HOST}/cocoinsight")
638
-
639
664
  if run_setup:
640
665
  _setup_flows(
641
666
  flow.flows().values(),
@@ -643,14 +668,19 @@ def _run_server(
643
668
  quiet=quiet,
644
669
  )
645
670
 
646
- if live_update:
647
- options = flow.FlowLiveUpdaterOptions(live_mode=True, print_stats=not quiet)
648
- flow.update_all_flows(options)
649
-
650
671
  lib.start_server(server_settings)
651
672
 
673
+ if COCOINDEX_HOST in cors_origins:
674
+ click.echo(f"Open CocoInsight at: {COCOINDEX_HOST}/cocoinsight")
675
+
652
676
  click.secho("Press Ctrl+C to stop the server.", fg="yellow")
653
677
 
678
+ if live_update:
679
+ options = flow.FlowLiveUpdaterOptions(live_mode=True, print_stats=not quiet)
680
+ asyncio.run_coroutine_threadsafe(
681
+ _update_all_flows_with_hint_async(options), execution_context.event_loop
682
+ )
683
+
654
684
  shutdown_event = threading.Event()
655
685
 
656
686
  def handle_signal(signum: int, frame: FrameType | None) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.61
3
+ Version: 0.1.63
4
4
  Requires-Dist: click>=8.1.8
5
5
  Requires-Dist: rich>=14.0.0
6
6
  Requires-Dist: python-dotenv>=1.1.0
@@ -162,6 +162,7 @@ It defines an index flow like this:
162
162
  | [FastAPI Server with Docker](examples/fastapi_server_docker) | Run the semantic search server in a Dockerized FastAPI setup |
163
163
  | [Product Recommendation](examples/product_recommendation) | Build real-time product recommendations with LLM and graph database|
164
164
  | [Image Search with Vision API](examples/image_search) | Generates detailed captions for images using a vision model, embeds them, enables live-updating semantic search via FastAPI and served on a React frontend|
165
+ | [Paper Metadata](examples/paper_metadata) | Index papers in PDF files, and build metadata tables for each paper |
165
166
 
166
167
  More coming and stay tuned 👀!
167
168
 
@@ -1,11 +1,11 @@
1
- cocoindex-0.1.61.dist-info/METADATA,sha256=k-_WSzTH8tqfDz3Vk_LmL6iZIH1IcrlxYvxXpXxzJ1c,10020
2
- cocoindex-0.1.61.dist-info/WHEEL,sha256=TukzpKFr1idb1-jhlJ5YrX48K0jJGkUZ6ZjYHenSQjw,116
3
- cocoindex-0.1.61.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
- cocoindex-0.1.61.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1
+ cocoindex-0.1.63.dist-info/METADATA,sha256=5p9o6R9LBv3kIl3GdIo-V40NqnF7DEZHgRTzKxuWFEQ,10136
2
+ cocoindex-0.1.63.dist-info/WHEEL,sha256=TukzpKFr1idb1-jhlJ5YrX48K0jJGkUZ6ZjYHenSQjw,116
3
+ cocoindex-0.1.63.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
+ cocoindex-0.1.63.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
5
  cocoindex/__init__.py,sha256=hDjehCjxRabFCW0RTt00JxnSAJIn9HeVoK4OjFbETsk,1910
6
- cocoindex/_engine.pypy311-pp73-aarch64-linux-gnu.so,sha256=iGa3xlQafx5sPMLgkmjz8VYw9e2v4czTBrs6PPndmNk,60997472
6
+ cocoindex/_engine.pypy311-pp73-aarch64-linux-gnu.so,sha256=Mbfu0iGrmgQNrMy85sB0tpoIh0vEzAxaXQybNoISSVs,61001616
7
7
  cocoindex/auth_registry.py,sha256=1XqO7ibjmBBd8i11XSJTvTgdz8p1ptW-ZpuSgo_5zzk,716
8
- cocoindex/cli.py,sha256=8bDL-Qmd9NYtn1DsDfvUMk45xfAqNf9YTyM7H9KRuNU,21345
8
+ cocoindex/cli.py,sha256=-gp639JSyQN6YjnhGqCakIzYoSSqXxQMbxbkcYGP0QY,22359
9
9
  cocoindex/convert.py,sha256=FsKb2Pfbm7e1VQDOs_AsoiW9PbIUuyHQuqUlrENXmUY,11199
10
10
  cocoindex/flow.py,sha256=x13SDZvFZ-MR-gGF1HPp14DMSn0vp37cfz0YFK9Pmy8,33334
11
11
  cocoindex/functions.py,sha256=IBwvdPpGR-S5mk53HvHpT2GVs15MI9wQznxgOdxA0ac,3202
@@ -25,4 +25,4 @@ cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt
25
25
  cocoindex/tests/test_typing.py,sha256=t6UCYShcfonTfjBlGRWPiFGMZ8DGFfABXo6idekPoJE,14757
26
26
  cocoindex/typing.py,sha256=s_Hk4Npi8pxJUM2h_7Km0VFrojA8wJU9VDtRqVSL6C0,12622
27
27
  cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
28
- cocoindex-0.1.61.dist-info/RECORD,,
28
+ cocoindex-0.1.63.dist-info/RECORD,,