pixie-prompts 0.1.9__tar.gz → 0.1.10__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixie-prompts
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: Code-first, type-safe prompt management
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -10,7 +10,11 @@ from watchdog.observers import Observer
10
10
  import asyncio
11
11
  import logging
12
12
 
13
- from pixie.prompts.storage import PromptLoadError, initialize_prompt_storage
13
+ from pixie.prompts.storage import (
14
+ PromptLoadError,
15
+ get_storage_root_directory,
16
+ initialize_prompt_storage,
17
+ )
14
18
 
15
19
  logger = logging.getLogger(__name__)
16
20
 
@@ -398,12 +402,8 @@ async def stop_storage_watcher() -> None:
398
402
 
399
403
 
400
404
  def init_prompt_storage():
401
- """Initialize prompt storage and return lifespan context manager.
402
-
403
- Storage directory is read from PIXIE_PROMPT_STORAGE_DIR environment variable,
404
- defaulting to '.pixie/prompts'.
405
- """
406
- storage_directory = os.getenv("PIXIE_PROMPT_STORAGE_DIR", ".pixie/prompts")
405
+ """Initialize prompt storage and return lifespan context manager."""
406
+ storage_directory = get_storage_root_directory()
407
407
  try:
408
408
  initialize_prompt_storage()
409
409
  except PromptLoadError as e:
@@ -49,7 +49,7 @@ key is the id() of the compiled string."""
49
49
  def _find_matching_prompt(obj):
50
50
  if isinstance(obj, str):
51
51
  for compiled in _compiled_prompt_registry.values():
52
- if compiled.value == obj:
52
+ if compiled.value in obj:
53
53
  return compiled
54
54
  return None
55
55
  elif isinstance(obj, dict):
@@ -76,7 +76,7 @@ def get_compiled_prompt(text: str) -> CompiledPrompt | None:
76
76
  if direct_match:
77
77
  return direct_match
78
78
  for compiled in _compiled_prompt_registry.values():
79
- if compiled.value == text:
79
+ if compiled.value in text:
80
80
  return compiled
81
81
  try:
82
82
  obj = json.loads(text)
@@ -260,6 +260,10 @@ class _FilePromptStorage(PromptStorage):
260
260
  _storage_instance: PromptStorage | None = None
261
261
 
262
262
 
263
+ def get_storage_root_directory() -> str:
264
+ return os.getenv("PIXIE_PROMPT_STORAGE_DIR", ".pixie/prompts")
265
+
266
+
263
267
  def _ensure_storage_initialized() -> PromptStorage:
264
268
  """Ensure storage is initialized, initializing it if necessary.
265
269
 
@@ -268,7 +272,7 @@ def _ensure_storage_initialized() -> PromptStorage:
268
272
  """
269
273
  global _storage_instance
270
274
  if _storage_instance is None:
271
- storage_directory = os.getenv("PIXIE_PROMPT_STORAGE_DIR", ".pixie/prompts")
275
+ storage_directory = get_storage_root_directory()
272
276
  _storage_instance = _FilePromptStorage(storage_directory, raise_on_error=False)
273
277
  logger.info(
274
278
  "Auto-initialized prompt storage at directory: %s", storage_directory
@@ -4,7 +4,7 @@ packages = [
4
4
  { include = "pixie" },
5
5
  ]
6
6
 
7
- version = "0.1.9"
7
+ version = "0.1.10"
8
8
  description = "Code-first, type-safe prompt management"
9
9
  authors = ["Yiou Li <yol@gopixie.ai>"]
10
10
  license = "MIT"
File without changes
File without changes