unitysvc-core 0.3.13__tar.gz → 0.3.14__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.
Files changed (64) hide show
  1. {unitysvc_core-0.3.13/src/unitysvc_core.egg-info → unitysvc_core-0.3.14}/PKG-INFO +3 -7
  2. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/README.md +2 -6
  3. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/pyproject.toml +1 -1
  4. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/channel.py +0 -12
  5. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14/src/unitysvc_core.egg-info}/PKG-INFO +3 -7
  6. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_container.py +5 -16
  7. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/LICENSE +0 -0
  8. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/setup.cfg +0 -0
  9. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/__init__.py +0 -0
  10. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/grants.py +0 -0
  11. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/instance_spec.py +0 -0
  12. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/__init__.py +0 -0
  13. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/base.py +0 -0
  14. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/container.py +0 -0
  15. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/documents.py +0 -0
  16. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/listing_data.py +0 -0
  17. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/listing_v1.py +0 -0
  18. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/manifest.py +0 -0
  19. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/offering_data.py +0 -0
  20. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/offering_v1.py +0 -0
  21. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/pricing.py +0 -0
  22. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/probes.py +0 -0
  23. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/promotion_data.py +0 -0
  24. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/provider_data.py +0 -0
  25. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/provider_v1.py +0 -0
  26. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/service.py +0 -0
  27. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/service_group_data.py +0 -0
  28. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/models/validators.py +0 -0
  29. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/parameter_usage.py +0 -0
  30. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/py.typed +0 -0
  31. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/base.json +0 -0
  32. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/listing_v1.json +0 -0
  33. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/normalized_manifest_v1.json +0 -0
  34. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/offering_v1.json +0 -0
  35. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/probes_v1.json +0 -0
  36. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/promotion_v1.json +0 -0
  37. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/provider_v1.json +0 -0
  38. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/schema/service_group_v1.json +0 -0
  39. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/utils.py +0 -0
  40. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core/validator.py +0 -0
  41. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core.egg-info/SOURCES.txt +0 -0
  42. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core.egg-info/dependency_links.txt +0 -0
  43. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core.egg-info/requires.txt +0 -0
  44. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/src/unitysvc_core.egg-info/top_level.txt +0 -0
  45. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_access_interface_routing.py +0 -0
  46. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_canonical_interfaces.py +0 -0
  47. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_channel.py +0 -0
  48. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_documents.py +0 -0
  49. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_effective_price.py +0 -0
  50. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_external_apps.py +0 -0
  51. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_grants.py +0 -0
  52. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_hidden_path_skip.py +0 -0
  53. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_listing_audience.py +0 -0
  54. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_offering_data.py +0 -0
  55. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_parameter_usage.py +0 -0
  56. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_pricing.py +0 -0
  57. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_provider_account_rate_limits.py +0 -0
  58. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_request_rules.py +0 -0
  59. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_service_group.py +0 -0
  60. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_service_status.py +0 -0
  61. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_utils.py +0 -0
  62. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_validate_service.py +0 -0
  63. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_validator.py +0 -0
  64. {unitysvc_core-0.3.13 → unitysvc_core-0.3.14}/tests/test_validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitysvc-core
3
- Version: 0.3.13
3
+ Version: 0.3.14
4
4
  Summary: Shared data models and validation helpers for UnitySVC packages
5
5
  Author-email: Bo Peng <bo.peng@unitysvc.com>
6
6
  Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
@@ -290,18 +290,14 @@ A `container` channel is one tier of a service that runs as instances on Kuberne
290
290
  "base": {
291
291
  "access_method": "container",
292
292
  "resources": {"limits": {"cpu": "250m", "memory": "256Mi", "ephemeral-storage": "1Gi"}},
293
- "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}],
294
- "customer_access_requests": [
295
- {"object": "resource:container", "permissions": ["create"], "required": true,
296
- "justification": "Run a disposable application instance for this enrollment"}
297
- ]
293
+ "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}]
298
294
  }
299
295
  }
300
296
  ```
301
297
 
302
298
  - There is no per-channel spec: every container channel of the offering runs the offering's one instance spec (below), so tiers differ in `resources`, not in stack. The earlier `spec` field (a Document title) is removed in 0.3.11; a channel carrying it is refused as an unknown field.
303
299
  - `resources` is the tier total, in Kubernetes' shape: `limits`, optionally `requests`, each a map from a resource name to a quantity (`250m`, `1Gi`, `1e3`, parsed as Kubernetes parses them). The names are `cpu`, `memory`, `ephemeral-storage` and `nvidia.com/gpu`; the first three limits are required; a request is at most its limit; a GPU is a whole number with a request equal to the limit. `resources.services` is an optional per-service split (`{"web": {"limits": {...}}}`) whose sums must stay within the tier (each share names `cpu`, `memory` and `ephemeral-storage`, and a resource without a request counts at its limit, as the agent resolves it); a spec with several services needs one. Quantities are at most 64 characters with an exponent of at most 30. A Compose `deploy.resources` is ignored: the channel is authoritative.
304
- - The channel is always enrollable and must request `resource:container` with `create`, marked `required` (`grants.RESOURCES` knows the resource; it has no options and no limits).
300
+ - The channel is always enrollable and needs no `customer_access_requests`: the customer runs their own instance, which grants the seller nothing (a request is for the seller to call the customer's services). A channel that does declare one is `me_bound` instead of `enrollable`.
305
301
  - `servers` is optional and has no container-specific meaning: each is an ordinary `HttpServer` the gateway reaches, for example `{"base_url": "https://{{ enrollment.code }}.unitysvc.app/"}`. A container-only service sets no `servers`. An enrollable channel is reached at `/e/<CODE>` on the API gateway, which the platform provides; a listing never declares it (see Canonical user access interfaces).
306
302
  - `entries` (`name`, `service`, `port`, optional `path`, `auth` of `login`, `key` or `app`) is **provisional** (open question 1 of #105: whether instances need URLs beyond `servers`, and which `auth` values apply; `gateway` is deliberately not accepted).
307
303
  - `params` and `customer_access_requests` are as on the other channels.
@@ -254,18 +254,14 @@ A `container` channel is one tier of a service that runs as instances on Kuberne
254
254
  "base": {
255
255
  "access_method": "container",
256
256
  "resources": {"limits": {"cpu": "250m", "memory": "256Mi", "ephemeral-storage": "1Gi"}},
257
- "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}],
258
- "customer_access_requests": [
259
- {"object": "resource:container", "permissions": ["create"], "required": true,
260
- "justification": "Run a disposable application instance for this enrollment"}
261
- ]
257
+ "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}]
262
258
  }
263
259
  }
264
260
  ```
265
261
 
266
262
  - There is no per-channel spec: every container channel of the offering runs the offering's one instance spec (below), so tiers differ in `resources`, not in stack. The earlier `spec` field (a Document title) is removed in 0.3.11; a channel carrying it is refused as an unknown field.
267
263
  - `resources` is the tier total, in Kubernetes' shape: `limits`, optionally `requests`, each a map from a resource name to a quantity (`250m`, `1Gi`, `1e3`, parsed as Kubernetes parses them). The names are `cpu`, `memory`, `ephemeral-storage` and `nvidia.com/gpu`; the first three limits are required; a request is at most its limit; a GPU is a whole number with a request equal to the limit. `resources.services` is an optional per-service split (`{"web": {"limits": {...}}}`) whose sums must stay within the tier (each share names `cpu`, `memory` and `ephemeral-storage`, and a resource without a request counts at its limit, as the agent resolves it); a spec with several services needs one. Quantities are at most 64 characters with an exponent of at most 30. A Compose `deploy.resources` is ignored: the channel is authoritative.
268
- - The channel is always enrollable and must request `resource:container` with `create`, marked `required` (`grants.RESOURCES` knows the resource; it has no options and no limits).
264
+ - The channel is always enrollable and needs no `customer_access_requests`: the customer runs their own instance, which grants the seller nothing (a request is for the seller to call the customer's services). A channel that does declare one is `me_bound` instead of `enrollable`.
269
265
  - `servers` is optional and has no container-specific meaning: each is an ordinary `HttpServer` the gateway reaches, for example `{"base_url": "https://{{ enrollment.code }}.unitysvc.app/"}`. A container-only service sets no `servers`. An enrollable channel is reached at `/e/<CODE>` on the API gateway, which the platform provides; a listing never declares it (see Canonical user access interfaces).
270
266
  - `entries` (`name`, `service`, `port`, optional `path`, `auth` of `login`, `key` or `app`) is **provisional** (open question 1 of #105: whether instances need URLs beyond `servers`, and which `auth` values apply; `gateway` is deliberately not accepted).
271
267
  - `params` and `customer_access_requests` are as on the other channels.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "unitysvc-core"
7
- version = "0.3.13"
7
+ version = "0.3.14"
8
8
  description = "Shared data models and validation helpers for UnitySVC packages"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Bo Peng", email = "bo.peng@unitysvc.com" }]
@@ -448,18 +448,6 @@ class ContainerChannel(_ChannelBase):
448
448
  def _check_container(self) -> "ContainerChannel":
449
449
  if self.type not in (None, "enrollable"):
450
450
  raise ValueError("a container channel is always enrollable: omit 'type' or set it to 'enrollable'")
451
- requests = self.customer_access_requests or []
452
- if not any(
453
- r.get("object") == "resource:container"
454
- and "create" in (r.get("permissions") or [])
455
- and r.get("required") is True
456
- for r in requests
457
- ):
458
- raise ValueError(
459
- "a container channel must request resource:container with the create permission, and mark it "
460
- 'required: customer_access_requests: [{"object": "resource:container", "permissions": ["create"], '
461
- '"required": true, "justification": "..."}]'
462
- )
463
451
  names = [entry.name for entry in self.entries or []]
464
452
  if duplicates := sorted({n for n in names if names.count(n) > 1}):
465
453
  raise ValueError(f"entry names must be unique: {', '.join(duplicates)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitysvc-core
3
- Version: 0.3.13
3
+ Version: 0.3.14
4
4
  Summary: Shared data models and validation helpers for UnitySVC packages
5
5
  Author-email: Bo Peng <bo.peng@unitysvc.com>
6
6
  Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
@@ -290,18 +290,14 @@ A `container` channel is one tier of a service that runs as instances on Kuberne
290
290
  "base": {
291
291
  "access_method": "container",
292
292
  "resources": {"limits": {"cpu": "250m", "memory": "256Mi", "ephemeral-storage": "1Gi"}},
293
- "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}],
294
- "customer_access_requests": [
295
- {"object": "resource:container", "permissions": ["create"], "required": true,
296
- "justification": "Run a disposable application instance for this enrollment"}
297
- ]
293
+ "entries": [{"name": "web", "service": "web", "port": 5678, "auth": "key"}]
298
294
  }
299
295
  }
300
296
  ```
301
297
 
302
298
  - There is no per-channel spec: every container channel of the offering runs the offering's one instance spec (below), so tiers differ in `resources`, not in stack. The earlier `spec` field (a Document title) is removed in 0.3.11; a channel carrying it is refused as an unknown field.
303
299
  - `resources` is the tier total, in Kubernetes' shape: `limits`, optionally `requests`, each a map from a resource name to a quantity (`250m`, `1Gi`, `1e3`, parsed as Kubernetes parses them). The names are `cpu`, `memory`, `ephemeral-storage` and `nvidia.com/gpu`; the first three limits are required; a request is at most its limit; a GPU is a whole number with a request equal to the limit. `resources.services` is an optional per-service split (`{"web": {"limits": {...}}}`) whose sums must stay within the tier (each share names `cpu`, `memory` and `ephemeral-storage`, and a resource without a request counts at its limit, as the agent resolves it); a spec with several services needs one. Quantities are at most 64 characters with an exponent of at most 30. A Compose `deploy.resources` is ignored: the channel is authoritative.
304
- - The channel is always enrollable and must request `resource:container` with `create`, marked `required` (`grants.RESOURCES` knows the resource; it has no options and no limits).
300
+ - The channel is always enrollable and needs no `customer_access_requests`: the customer runs their own instance, which grants the seller nothing (a request is for the seller to call the customer's services). A channel that does declare one is `me_bound` instead of `enrollable`.
305
301
  - `servers` is optional and has no container-specific meaning: each is an ordinary `HttpServer` the gateway reaches, for example `{"base_url": "https://{{ enrollment.code }}.unitysvc.app/"}`. A container-only service sets no `servers`. An enrollable channel is reached at `/e/<CODE>` on the API gateway, which the platform provides; a listing never declares it (see Canonical user access interfaces).
306
302
  - `entries` (`name`, `service`, `port`, optional `path`, `auth` of `login`, `key` or `app`) is **provisional** (open question 1 of #105: whether instances need URLs beyond `servers`, and which `auth` values apply; `gateway` is deliberately not accepted).
307
303
  - `params` and `customer_access_requests` are as on the other channels.
@@ -48,7 +48,6 @@ def _channel(**changes: Any) -> dict[str, Any]:
48
48
  channel: dict[str, Any] = {
49
49
  "access_method": "container",
50
50
  "resources": {"limits": dict(LIMITS)},
51
- "customer_access_requests": [dict(REQUEST)],
52
51
  }
53
52
  channel.update(changes)
54
53
  return channel
@@ -225,25 +224,15 @@ class TestChannel:
225
224
  with pytest.raises(ValidationError, match="resources"):
226
225
  ContainerChannel.model_validate(data)
227
226
 
228
- @pytest.mark.parametrize(
229
- "requests",
230
- [
231
- None,
232
- [],
233
- [{**REQUEST, "required": False}],
234
- [{**REQUEST, "permissions": ["join"]}],
235
- [{"object": "service:x", "permissions": ["invoke"], "required": True, "justification": "x"}],
236
- ],
237
- )
238
- def test_requires_the_container_create_request(self, requests: Any) -> None:
239
- data = _channel(customer_access_requests=requests)
240
- with pytest.raises(ValidationError, match="resource:container"):
241
- ContainerChannel.model_validate(data)
227
+ def test_a_container_channel_needs_no_access_request(self) -> None:
228
+ """The customer runs their own instance and grants the seller nothing (unitysvc#3023)."""
229
+ channel = ContainerChannel.model_validate(_channel())
230
+ assert not channel.customer_access_requests
242
231
 
243
232
  def test_the_request_passes_the_grants_checks(self, tmp_path: Path) -> None:
244
233
  (tmp_path / "compose.yaml").write_text(_compose())
245
234
  errors = DataValidator(EXAMPLES, SCHEMA_DIR).validate_service(
246
- offering=_offering({"base": _channel()}), service_dir=tmp_path
235
+ offering=_offering({"base": _channel(customer_access_requests=[REQUEST])}), service_dir=tmp_path
247
236
  )
248
237
  assert errors["offering"] == []
249
238
 
File without changes
File without changes