unitysvc-services 0.1.7__py3-none-any.whl → 0.1.8__py3-none-any.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.

Potentially problematic release.


This version of unitysvc-services might be problematic. Click here for more details.

unitysvc_services/test.py CHANGED
@@ -473,9 +473,14 @@ def list_code_examples(
473
473
  code_examples = extract_code_examples_from_listing(listing_data, listing_file)
474
474
 
475
475
  for example in code_examples:
476
- # Get file extension
476
+ # Get file extension (strip .j2 if present to show actual type)
477
477
  file_path = example.get("file_path", "")
478
- file_ext = Path(file_path).suffix or "unknown"
478
+ path = Path(file_path)
479
+ # If it's a .j2 template, get the extension before .j2
480
+ if path.suffix == ".j2":
481
+ file_ext = Path(path.stem).suffix or "unknown"
482
+ else:
483
+ file_ext = path.suffix or "unknown"
479
484
  all_code_examples.append((example, prov_name, file_ext))
480
485
 
481
486
  if not all_code_examples:
@@ -535,6 +540,12 @@ def run(
535
540
  "-s",
536
541
  help="Comma-separated list of service patterns (supports wildcards, e.g., 'llama*,gpt-4*')",
537
542
  ),
543
+ test_file: str | None = typer.Option(
544
+ None,
545
+ "--test-file",
546
+ "-t",
547
+ help="Only run a specific test file by filename (e.g., 'code-example.py.j2')",
548
+ ),
538
549
  verbose: bool = typer.Option(
539
550
  False,
540
551
  "--verbose",
@@ -564,6 +575,9 @@ def run(
564
575
  # Test single service
565
576
  unitysvc_services test run --services "llama-3-1-405b-instruct"
566
577
 
578
+ # Test specific file
579
+ unitysvc_services test run --test-file "code-example.py.j2"
580
+
567
581
  # Combine filters
568
582
  unitysvc_services test run --provider fireworks --services "llama*"
569
583
 
@@ -590,6 +604,10 @@ def run(
590
604
  service_patterns = [s.strip() for s in services.split(",") if s.strip()]
591
605
  console.print(f"[blue]Service filter patterns:[/blue] {', '.join(service_patterns)}\n")
592
606
 
607
+ # Display test file filter if provided
608
+ if test_file:
609
+ console.print(f"[blue]Test file filter:[/blue] {test_file}\n")
610
+
593
611
  console.print(f"[blue]Scanning for listing files in:[/blue] {data_dir}\n")
594
612
 
595
613
  # Find all provider files first to get credentials
@@ -661,6 +679,13 @@ def run(
661
679
  code_examples = extract_code_examples_from_listing(listing_data, listing_file)
662
680
 
663
681
  for example in code_examples:
682
+ # Filter by test file name if provided
683
+ if test_file:
684
+ file_path = example.get("file_path", "")
685
+ # Check if the file path ends with the test file name
686
+ if not file_path.endswith(test_file):
687
+ continue
688
+
664
689
  all_code_examples.append((example, prov_name))
665
690
 
666
691
  if not all_code_examples:
@@ -729,8 +754,8 @@ def run(
729
754
  actual_filename = result["actual_filename"]
730
755
  listing_stem = listing_file.stem
731
756
 
732
- # Create filename: failed_{listing_stem}_{actual_filename}
733
- failed_filename = f"failed_{listing_stem}_{actual_filename}"
757
+ # Create filename: failed_{service_name}_{listing_stem}_{actual_filename}
758
+ failed_filename = f"failed_{service_name}_{listing_stem}_{actual_filename}"
734
759
 
735
760
  # Prepare content with environment variables as header comments
736
761
  content_with_env = result["rendered_content"]
@@ -32,7 +32,22 @@ class DataValidator:
32
32
 
33
33
  def load_schemas(self) -> None:
34
34
  """Load all JSON schemas from the schema directory."""
35
- for schema_file in self.schema_dir.glob("*.json"):
35
+ if not self.schema_dir.exists():
36
+ raise DataValidationError(
37
+ f"Schema directory not found: {self.schema_dir}\n"
38
+ f"This may indicate the package was not installed correctly. "
39
+ f"Please reinstall with: pip install --force-reinstall unitysvc-services"
40
+ )
41
+
42
+ schema_files = list(self.schema_dir.glob("*.json"))
43
+ if not schema_files:
44
+ raise DataValidationError(
45
+ f"No schema files (*.json) found in schema directory: {self.schema_dir}\n"
46
+ f"This may indicate the package was not installed correctly. "
47
+ f"Please reinstall with: pip install --force-reinstall unitysvc-services"
48
+ )
49
+
50
+ for schema_file in schema_files:
36
51
  schema_name = schema_file.stem
37
52
  try:
38
53
  with open(schema_file, encoding="utf-8") as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitysvc-services
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: SDK for digital service providers on UnitySVC
5
5
  Author-email: Bo Peng <bo.peng@unitysvc.com>
6
6
  Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
@@ -8,19 +8,24 @@ unitysvc_services/publisher.py,sha256=_r6wqJJkC-9RtyKcxiegPoSRDi2-nRL16M8OJ-vi7e
8
8
  unitysvc_services/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  unitysvc_services/query.py,sha256=q0_g5YAl9cPlHpW7k7Y6A-t4fQSdI-_4Jl6g2KgkEm0,24049
10
10
  unitysvc_services/scaffold.py,sha256=Y73IX8vskImxSvxDgR0mvEFuAMYnBKfttn3bjcz3jmQ,40331
11
- unitysvc_services/test.py,sha256=nZp6O_j2Y-gNPNWJ55QG4kI50BsbS_faUFGupWK1VMI,29734
11
+ unitysvc_services/test.py,sha256=4ydyfx1HWAbmE_kHl3tkH9Jy0d0Zg3kshgoCvGnxwDY,30726
12
12
  unitysvc_services/update.py,sha256=K9swocTUnqqiSgARo6GmuzTzUySSpyqqPPW4xF7ZU-g,9659
13
13
  unitysvc_services/utils.py,sha256=4tEBdO90XpkS6j73ZXnz5dNLVXJaPUILWMwzk5_fUQ4,15276
14
- unitysvc_services/validator.py,sha256=sasMpdDhoWZJZ-unrnDhaJfyxHSm3IgQjEdmPvXrFEE,29525
14
+ unitysvc_services/validator.py,sha256=NYoIWV2iMyjse1-mIVz2GnFXNDewLnJVDIDAjqnsBCs,30241
15
15
  unitysvc_services/models/__init__.py,sha256=hJCc2KSZmIHlKWKE6GpLGdeVB6LIpyVUKiOKnwmKvCs,200
16
16
  unitysvc_services/models/base.py,sha256=ofdxWkzSxCB3JqMCnNHL83KfWlXZ9A4HbNRtKG6jcMQ,18333
17
17
  unitysvc_services/models/listing_v1.py,sha256=PPb9hIdWQp80AWKLxFXYBDcWXzNcDrO4v6rqt5_i2qo,3083
18
18
  unitysvc_services/models/provider_v1.py,sha256=76EK1i0hVtdx_awb00-ZMtSj4Oc9Zp4xZ-DeXmG3iTY,2701
19
19
  unitysvc_services/models/seller_v1.py,sha256=oll2ZZBPBDX8wslHrbsCKf_jIqHNte2VEj5RJ9bawR4,3520
20
20
  unitysvc_services/models/service_v1.py,sha256=Xpk-K-95M1LRqYM8nNJcll8t-lsW9Xdi2_bVbYNs8-M,3019
21
- unitysvc_services-0.1.7.dist-info/licenses/LICENSE,sha256=_p8V6A8OMPu2HIztn3O01v0-urZFwk0Dd3Yk_PTIlL8,1065
22
- unitysvc_services-0.1.7.dist-info/METADATA,sha256=WrTTofhHZReTM3ArgJ8E76Cb-tgJpJikNfL8bBg58Go,7234
23
- unitysvc_services-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- unitysvc_services-0.1.7.dist-info/entry_points.txt,sha256=RBhVHKky3rsOly4jVa29c7UAw5ZwNNWnttmtzozr5O0,97
25
- unitysvc_services-0.1.7.dist-info/top_level.txt,sha256=GIotQj-Ro2ruR7eupM1r58PWqIHTAq647ORL7E2kneo,18
26
- unitysvc_services-0.1.7.dist-info/RECORD,,
21
+ unitysvc_services/schema/base.json,sha256=-oOHKv3DYxUWrlCthI7ut9zM-pgybHkwSgEL_EB1_fU,17971
22
+ unitysvc_services/schema/listing_v1.json,sha256=gzSK5ncnqmcb44WPnv0FG9xyJ-wUzncayosLwV8oN7c,24122
23
+ unitysvc_services/schema/provider_v1.json,sha256=L2rudq1RcfAE67WJXmowJu5_YReqxioiQO0263SWaNc,22033
24
+ unitysvc_services/schema/seller_v1.json,sha256=QhYuaJBugWVbgAEBhrSyYAPT1Ss_6Z0rz0lA2FhJOo8,8841
25
+ unitysvc_services/schema/service_v1.json,sha256=sifCZzx0hT7k6tpDCkPUgXYG9e5OVUaeKudTjEPFO4E,24293
26
+ unitysvc_services-0.1.8.dist-info/licenses/LICENSE,sha256=_p8V6A8OMPu2HIztn3O01v0-urZFwk0Dd3Yk_PTIlL8,1065
27
+ unitysvc_services-0.1.8.dist-info/METADATA,sha256=5aBwnpthsr774DSkKkQg7lyzWqFWGcb1Paf1mr3Bm7E,7234
28
+ unitysvc_services-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ unitysvc_services-0.1.8.dist-info/entry_points.txt,sha256=RBhVHKky3rsOly4jVa29c7UAw5ZwNNWnttmtzozr5O0,97
30
+ unitysvc_services-0.1.8.dist-info/top_level.txt,sha256=GIotQj-Ro2ruR7eupM1r58PWqIHTAq647ORL7E2kneo,18
31
+ unitysvc_services-0.1.8.dist-info/RECORD,,