unitysvc-services 0.1.1__py3-none-any.whl → 0.2.1__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.
@@ -1,6 +1,5 @@
1
1
  """Format command - format data files."""
2
2
 
3
- import os
4
3
  from pathlib import Path
5
4
 
6
5
  import typer
@@ -14,7 +13,7 @@ console = Console()
14
13
  def format_data(
15
14
  data_dir: Path | None = typer.Argument(
16
15
  None,
17
- help="Directory containing data files to format (default: ./data or UNITYSVC_DATA_DIR env var)",
16
+ help="Directory containing data files to format (default: current directory)",
18
17
  ),
19
18
  check_only: bool = typer.Option(
20
19
  False,
@@ -35,11 +34,7 @@ def format_data(
35
34
 
36
35
  # Set data directory
37
36
  if data_dir is None:
38
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
39
- if data_dir_str:
40
- data_dir = Path(data_dir_str)
41
- else:
42
- data_dir = Path.cwd() / "data"
37
+ data_dir = Path.cwd()
43
38
 
44
39
  if not data_dir.is_absolute():
45
40
  data_dir = Path.cwd() / data_dir
unitysvc_services/list.py CHANGED
@@ -1,6 +1,5 @@
1
1
  """List command group - list local data files."""
2
2
 
3
- import os
4
3
  from pathlib import Path
5
4
 
6
5
  import typer
@@ -21,25 +20,19 @@ console = Console()
21
20
  def list_providers(
22
21
  data_dir: Path | None = typer.Argument(
23
22
  None,
24
- help="Directory containing provider files (default: ./data or UNITYSVC_DATA_DIR env var)",
23
+ help="Directory containing provider files (default: current directory)",
25
24
  ),
26
25
  ):
27
26
  """List all provider files found in the data directory."""
28
27
  # Set data directory
29
28
  if data_dir is None:
30
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
31
- if data_dir_str:
32
- data_dir = Path(data_dir_str)
33
- else:
34
- data_dir = Path.cwd() / "data"
29
+ data_dir = Path.cwd()
35
30
 
36
31
  if not data_dir.is_absolute():
37
32
  data_dir = Path.cwd() / data_dir
38
33
 
39
34
  if not data_dir.exists():
40
- console.print(
41
- f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red"
42
- )
35
+ console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
43
36
  raise typer.Exit(code=1)
44
37
 
45
38
  console.print(f"[blue]Searching for providers in:[/blue] {data_dir}\n")
@@ -72,25 +65,19 @@ def list_providers(
72
65
  def list_sellers(
73
66
  data_dir: Path | None = typer.Argument(
74
67
  None,
75
- help="Directory containing seller files (default: ./data or UNITYSVC_DATA_DIR env var)",
68
+ help="Directory containing seller files (default: current directory)",
76
69
  ),
77
70
  ):
78
71
  """List all seller files found in the data directory."""
79
72
  # Set data directory
80
73
  if data_dir is None:
81
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
82
- if data_dir_str:
83
- data_dir = Path(data_dir_str)
84
- else:
85
- data_dir = Path.cwd() / "data"
74
+ data_dir = Path.cwd()
86
75
 
87
76
  if not data_dir.is_absolute():
88
77
  data_dir = Path.cwd() / data_dir
89
78
 
90
79
  if not data_dir.exists():
91
- console.print(
92
- f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red"
93
- )
80
+ console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
94
81
  raise typer.Exit(code=1)
95
82
 
96
83
  console.print(f"[blue]Searching for sellers in:[/blue] {data_dir}\n")
@@ -123,25 +110,19 @@ def list_sellers(
123
110
  def list_offerings(
124
111
  data_dir: Path | None = typer.Argument(
125
112
  None,
126
- help="Directory containing service files (default: ./data or UNITYSVC_DATA_DIR env var)",
113
+ help="Directory containing service files (default: current directory)",
127
114
  ),
128
115
  ):
129
116
  """List all service offering files found in the data directory."""
130
117
  # Set data directory
131
118
  if data_dir is None:
132
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
133
- if data_dir_str:
134
- data_dir = Path(data_dir_str)
135
- else:
136
- data_dir = Path.cwd() / "data"
119
+ data_dir = Path.cwd()
137
120
 
138
121
  if not data_dir.is_absolute():
139
122
  data_dir = Path.cwd() / data_dir
140
123
 
141
124
  if not data_dir.exists():
142
- console.print(
143
- f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red"
144
- )
125
+ console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
145
126
  raise typer.Exit(code=1)
146
127
 
147
128
  console.print(f"[blue]Searching for service offerings in:[/blue] {data_dir}\n")
@@ -172,34 +153,26 @@ def list_offerings(
172
153
  )
173
154
 
174
155
  console.print(table)
175
- console.print(
176
- f"\n[green]Total:[/green] {len(service_files)} service offering file(s)"
177
- )
156
+ console.print(f"\n[green]Total:[/green] {len(service_files)} service offering file(s)")
178
157
 
179
158
 
180
159
  @app.command("listings")
181
160
  def list_listings(
182
161
  data_dir: Path | None = typer.Argument(
183
162
  None,
184
- help="Directory containing listing files (default: ./data or UNITYSVC_DATA_DIR env var)",
163
+ help="Directory containing listing files (default: current directory)",
185
164
  ),
186
165
  ):
187
166
  """List all service listing files found in the data directory."""
188
167
  # Set data directory
189
168
  if data_dir is None:
190
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
191
- if data_dir_str:
192
- data_dir = Path(data_dir_str)
193
- else:
194
- data_dir = Path.cwd() / "data"
169
+ data_dir = Path.cwd()
195
170
 
196
171
  if not data_dir.is_absolute():
197
172
  data_dir = Path.cwd() / data_dir
198
173
 
199
174
  if not data_dir.exists():
200
- console.print(
201
- f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red"
202
- )
175
+ console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
203
176
  raise typer.Exit(code=1)
204
177
 
205
178
  console.print(f"[blue]Searching for service listings in:[/blue] {data_dir}\n")
@@ -240,6 +213,4 @@ def list_listings(
240
213
  )
241
214
 
242
215
  console.print(table)
243
- console.print(
244
- f"\n[green]Total:[/green] {len(listing_files)} service listing file(s)"
245
- )
216
+ console.print(f"\n[green]Total:[/green] {len(listing_files)} service listing file(s)")
@@ -228,16 +228,10 @@ class Document(BaseModel):
228
228
  # fields that will be stored in backend database
229
229
  #
230
230
  title: str = Field(min_length=5, max_length=255, description="Document title")
231
- description: str | None = Field(
232
- default=None, max_length=500, description="Document description"
233
- )
231
+ description: str | None = Field(default=None, max_length=500, description="Document description")
234
232
  mime_type: MimeTypeEnum = Field(description="Document MIME type")
235
- version: str | None = Field(
236
- default=None, max_length=50, description="Document version"
237
- )
238
- category: DocumentCategoryEnum = Field(
239
- description="Document category for organization and filtering"
240
- )
233
+ version: str | None = Field(default=None, max_length=50, description="Document version")
234
+ category: DocumentCategoryEnum = Field(description="Document category for organization and filtering")
241
235
  meta: dict[str, Any] | None = Field(
242
236
  default=None,
243
237
  description="JSON containing operation stats",
@@ -271,12 +265,8 @@ class RateLimit(BaseModel):
271
265
  window: TimeWindowEnum = Field(description="Time window for the limit")
272
266
 
273
267
  # Optional additional info
274
- description: str | None = Field(
275
- default=None, max_length=255, description="Human-readable description"
276
- )
277
- burst_limit: int | None = Field(
278
- default=None, description="Short-term burst allowance"
279
- )
268
+ description: str | None = Field(default=None, max_length=255, description="Human-readable description")
269
+ burst_limit: int | None = Field(default=None, description="Short-term burst allowance")
280
270
 
281
271
  # Status
282
272
  is_active: bool = Field(default=True, description="Whether rate limit is active")
@@ -286,105 +276,57 @@ class ServiceConstraints(BaseModel):
286
276
  model_config = ConfigDict(extra="forbid")
287
277
 
288
278
  # Usage Quotas & Billing
289
- monthly_quota: int | None = Field(
290
- default=None, description="Monthly usage quota (requests, tokens, etc.)"
291
- )
292
- daily_quota: int | None = Field(
293
- default=None, description="Daily usage quota (requests, tokens, etc.)"
294
- )
295
- quota_unit: RateLimitUnitEnum | None = Field(
296
- default=None, description="Unit for quota limits"
297
- )
298
- quota_reset_cycle: QuotaResetCycleEnum | None = Field(
299
- default=None, description="How often quotas reset"
300
- )
301
- overage_policy: OveragePolicyEnum | None = Field(
302
- default=None, description="What happens when quota is exceeded"
303
- )
279
+ monthly_quota: int | None = Field(default=None, description="Monthly usage quota (requests, tokens, etc.)")
280
+ daily_quota: int | None = Field(default=None, description="Daily usage quota (requests, tokens, etc.)")
281
+ quota_unit: RateLimitUnitEnum | None = Field(default=None, description="Unit for quota limits")
282
+ quota_reset_cycle: QuotaResetCycleEnum | None = Field(default=None, description="How often quotas reset")
283
+ overage_policy: OveragePolicyEnum | None = Field(default=None, description="What happens when quota is exceeded")
304
284
 
305
285
  # Authentication & Security
306
- auth_methods: list[AuthMethodEnum] | None = Field(
307
- default=None, description="Supported authentication methods"
308
- )
309
- ip_whitelist_required: bool | None = Field(
310
- default=None, description="Whether IP whitelisting is required"
311
- )
312
- tls_version_min: str | None = Field(
313
- default=None, description="Minimum TLS version required"
314
- )
286
+ auth_methods: list[AuthMethodEnum] | None = Field(default=None, description="Supported authentication methods")
287
+ ip_whitelist_required: bool | None = Field(default=None, description="Whether IP whitelisting is required")
288
+ tls_version_min: str | None = Field(default=None, description="Minimum TLS version required")
315
289
 
316
290
  # Request/Response Constraints
317
- max_request_size_bytes: int | None = Field(
318
- default=None, description="Maximum request payload size in bytes"
319
- )
320
- max_response_size_bytes: int | None = Field(
321
- default=None, description="Maximum response payload size in bytes"
322
- )
323
- timeout_seconds: int | None = Field(
324
- default=None, description="Request timeout in seconds"
325
- )
326
- max_batch_size: int | None = Field(
327
- default=None, description="Maximum number of items in batch requests"
328
- )
291
+ max_request_size_bytes: int | None = Field(default=None, description="Maximum request payload size in bytes")
292
+ max_response_size_bytes: int | None = Field(default=None, description="Maximum response payload size in bytes")
293
+ timeout_seconds: int | None = Field(default=None, description="Request timeout in seconds")
294
+ max_batch_size: int | None = Field(default=None, description="Maximum number of items in batch requests")
329
295
 
330
296
  # Content & Model Restrictions
331
297
  content_filters: list[ContentFilterEnum] | None = Field(
332
298
  default=None, description="Active content filtering policies"
333
299
  )
334
- input_languages: list[str] | None = Field(
335
- default=None, description="Supported input languages (ISO 639-1 codes)"
336
- )
337
- output_languages: list[str] | None = Field(
338
- default=None, description="Supported output languages (ISO 639-1 codes)"
339
- )
340
- max_context_length: int | None = Field(
341
- default=None, description="Maximum context length in tokens"
342
- )
300
+ input_languages: list[str] | None = Field(default=None, description="Supported input languages (ISO 639-1 codes)")
301
+ output_languages: list[str] | None = Field(default=None, description="Supported output languages (ISO 639-1 codes)")
302
+ max_context_length: int | None = Field(default=None, description="Maximum context length in tokens")
343
303
  region_restrictions: list[str] | None = Field(
344
304
  default=None, description="Geographic restrictions (ISO country codes)"
345
305
  )
346
306
 
347
307
  # Availability & SLA
348
- uptime_sla_percent: float | None = Field(
349
- default=None, description="Uptime SLA percentage (e.g., 99.9)"
350
- )
351
- response_time_sla_ms: int | None = Field(
352
- default=None, description="Response time SLA in milliseconds"
353
- )
354
- maintenance_windows: list[str] | None = Field(
355
- default=None, description="Scheduled maintenance windows"
356
- )
308
+ uptime_sla_percent: float | None = Field(default=None, description="Uptime SLA percentage (e.g., 99.9)")
309
+ response_time_sla_ms: int | None = Field(default=None, description="Response time SLA in milliseconds")
310
+ maintenance_windows: list[str] | None = Field(default=None, description="Scheduled maintenance windows")
357
311
 
358
312
  # Concurrency & Connection Limits
359
- max_concurrent_requests: int | None = Field(
360
- default=None, description="Maximum concurrent requests allowed"
361
- )
362
- connection_timeout_seconds: int | None = Field(
363
- default=None, description="Connection timeout in seconds"
364
- )
365
- max_connections_per_ip: int | None = Field(
366
- default=None, description="Maximum connections per IP address"
367
- )
313
+ max_concurrent_requests: int | None = Field(default=None, description="Maximum concurrent requests allowed")
314
+ connection_timeout_seconds: int | None = Field(default=None, description="Connection timeout in seconds")
315
+ max_connections_per_ip: int | None = Field(default=None, description="Maximum connections per IP address")
368
316
 
369
317
 
370
318
  class AccessInterface(BaseModel):
371
319
  model_config = ConfigDict(extra="allow")
372
320
 
373
- access_method: AccessMethodEnum = Field(
374
- default=AccessMethodEnum.http, description="Type of access method"
375
- )
321
+ access_method: AccessMethodEnum = Field(default=AccessMethodEnum.http, description="Type of access method")
376
322
 
377
323
  api_endpoint: str = Field(max_length=500, description="API endpoint URL")
378
324
 
379
- api_key: str | None = Field(
380
- default=None, max_length=2000, description="API key if required"
381
- )
325
+ api_key: str | None = Field(default=None, max_length=2000, description="API key if required")
382
326
 
383
327
  name: str | None = Field(default=None, max_length=100, description="Interface name")
384
328
 
385
- description: str | None = Field(
386
- default=None, max_length=500, description="Interface description"
387
- )
329
+ description: str | None = Field(default=None, max_length=500, description="Interface description")
388
330
 
389
331
  request_transformer: dict[RequestTransformEnum, dict[str, Any]] | None = Field(
390
332
  default=None, description="Request transformation configuration"
@@ -398,13 +340,9 @@ class AccessInterface(BaseModel):
398
340
  default=None,
399
341
  description="Rate limit",
400
342
  )
401
- constraint: ServiceConstraints | None = Field(
402
- default=None, description="Service constraints and conditions"
403
- )
343
+ constraint: ServiceConstraints | None = Field(default=None, description="Service constraints and conditions")
404
344
  is_active: bool = Field(default=True, description="Whether interface is active")
405
- is_primary: bool = Field(
406
- default=False, description="Whether this is the primary interface"
407
- )
345
+ is_primary: bool = Field(default=False, description="Whether this is the primary interface")
408
346
  sort_order: int = Field(default=0, description="Display order")
409
347
 
410
348
 
@@ -412,13 +350,9 @@ class Pricing(BaseModel):
412
350
  model_config = ConfigDict(extra="forbid")
413
351
 
414
352
  # Pricing tier name (Basic, Pro, Enterprise, etc.)
415
- name: str | None = Field(
416
- default=None, description="Pricing tier name (e.g., Basic, Pro, Enterprise)"
417
- )
353
+ name: str | None = Field(default=None, description="Pricing tier name (e.g., Basic, Pro, Enterprise)")
418
354
 
419
- description: str | None = Field(
420
- default=None, description="Pricing model description"
421
- )
355
+ description: str | None = Field(default=None, description="Pricing model description")
422
356
 
423
357
  # Currency and description
424
358
  currency: str | None = Field(default=None, description="Currency code (e.g., USD)")
@@ -431,6 +365,4 @@ class Pricing(BaseModel):
431
365
  )
432
366
 
433
367
  # Optional reference to upstream pricing
434
- reference: str | None = Field(
435
- default=None, description="Reference URL to upstream pricing"
436
- )
368
+ reference: str | None = Field(default=None, description="Reference URL to upstream pricing")
@@ -17,9 +17,7 @@ class ListingV1(BaseModel):
17
17
  #
18
18
  # fields for business data collection and maintenance
19
19
  #
20
- schema_version: str = Field(
21
- default="listing_v1", description="Schema identifier", alias="schema"
22
- )
20
+ schema_version: str = Field(default="listing_v1", description="Schema identifier", alias="schema")
23
21
  time_created: datetime
24
22
 
25
23
  #
@@ -32,9 +30,7 @@ class ListingV1(BaseModel):
32
30
  ),
33
31
  )
34
32
 
35
- seller_name: str | None = Field(
36
- default=None, description="Name of the seller offering this service listing"
37
- )
33
+ seller_name: str | None = Field(default=None, description="Name of the seller offering this service listing")
38
34
 
39
35
  # unique name for each provider, usually following upstream naming convention
40
36
  # status of the service, public, deprecated etc
@@ -50,9 +46,7 @@ class ListingV1(BaseModel):
50
46
  # - code_examples
51
47
  # multiple access interfaces can be provided, for example, if the service
52
48
  # is available through multiple interfaces or service groups
53
- user_access_interfaces: list[AccessInterface] = Field(
54
- description="Dictionary of user access interfaces"
55
- )
49
+ user_access_interfaces: list[AccessInterface] = Field(description="Dictionary of user access interfaces")
56
50
 
57
51
  #
58
52
  # how upstream charges for their services, which can include
@@ -12,17 +12,13 @@ class ProviderV1(BaseModel):
12
12
  #
13
13
  # fields for business data collection and maintenance
14
14
  #
15
- schema_version: str = Field(
16
- default="provider_v1", description="Schema identifier", alias="schema"
17
- )
15
+ schema_version: str = Field(default="provider_v1", description="Schema identifier", alias="schema")
18
16
  time_created: datetime
19
17
  # how to automatically populate service data, if available
20
18
  services_populator: dict[str, Any] | None = None
21
19
  # parameters for accessing service provider, which typically
22
20
  # include "api_endpoint" and "api_key"
23
- provider_access_info: AccessInterface = Field(
24
- description="Dictionary of upstream access interface"
25
- )
21
+ provider_access_info: AccessInterface = Field(description="Dictionary of upstream access interface")
26
22
  #
27
23
  # fields that will be stored in backend database
28
24
  #
@@ -17,9 +17,7 @@ class SellerV1(BaseModel):
17
17
  #
18
18
  # fields for business data collection and maintenance
19
19
  #
20
- schema_version: str = Field(
21
- default="seller_v1", description="Schema identifier", alias="schema"
22
- )
20
+ schema_version: str = Field(default="seller_v1", description="Schema identifier", alias="schema")
23
21
  time_created: datetime
24
22
 
25
23
  #
@@ -49,9 +47,7 @@ class SellerV1(BaseModel):
49
47
  # Contact information
50
48
  contact_email: EmailStr = Field(description="Primary contact email for the seller")
51
49
 
52
- secondary_contact_email: EmailStr | None = Field(
53
- default=None, description="Secondary contact email"
54
- )
50
+ secondary_contact_email: EmailStr | None = Field(default=None, description="Secondary contact email")
55
51
 
56
52
  # Account manager
57
53
  account_manager: str | None = Field(
@@ -19,7 +19,7 @@ console = Console()
19
19
  def populate(
20
20
  data_dir: Path | None = typer.Argument(
21
21
  None,
22
- help="Directory containing provider data files (default: ./data or UNITYSVC_DATA_DIR env var)",
22
+ help="Directory containing provider data files (default: current directory)",
23
23
  ),
24
24
  provider_name: str | None = typer.Option(
25
25
  None,
@@ -41,11 +41,7 @@ def populate(
41
41
  """
42
42
  # Set data directory
43
43
  if data_dir is None:
44
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
45
- if data_dir_str:
46
- data_dir = Path(data_dir_str)
47
- else:
48
- data_dir = Path.cwd() / "data"
44
+ data_dir = Path.cwd()
49
45
 
50
46
  if not data_dir.is_absolute():
51
47
  data_dir = Path.cwd() / data_dir