Skip to content

Commit a74b63d

Browse files
committed
prepare v0.8.0 release
Signed-off-by: Lance Drane <[email protected]>
1 parent 1753a2c commit a74b63d

File tree

16 files changed

+143
-14
lines changed

16 files changed

+143
-14
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
## [0.8.0] - 2024-09-10
6+
7+
_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._
8+
9+
### Changed
10+
11+
- **Breaking:** Service-to-service callback functions now take in four arguments (request message source, request message operation, error flag, response payload) instead of one ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/51ba9a8e0eb8c314014655bb0c989f5f98db715d)) .
12+
- **Breaking:** `IntersectBaseCapabilityImplementation.capability_name` renamed to `IntersectBaseCapabilityImplementation.intersect_sdk_capability_name`. This should now be explicitly defined as a class variable instead of an instance variable ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
13+
- **Breaking:** `get_schema_from_capability_implementation` renamed to `get_schema_from_capability_implementations` and now takes in a list of Capabilities instead of a single capability ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
14+
15+
### Fixed
16+
17+
- Fixed issue with multiple service-to-service calls causing thread deadlocking ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/51ba9a8e0eb8c314014655bb0c989f5f98db715d)) .
18+
- Correctly incorporates capabilities into internal schema generation ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
19+
- Removed MINIO from examples which do not use MINIO ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
20+
21+
### Added
22+
23+
- **Breaking:** Added basic validation logic for capability names. This causes the application to error out if using a duplicate capability name, or if using a capability name which is not an alphanumeric string (hyphens and underscores allowed) ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
24+
- Added 'timeout' parameter to `IntersectBaseCapabilityImplementation.intersect_sdk_call_service`. This is a floating point value which represents (in number of seconds) how long to wait for a response from the service. By default, the service will wait 300 seconds ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/51ba9a8e0eb8c314014655bb0c989f5f98db715d)) .
25+
- Added an example which uses MINIO ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
26+
327
## [0.7.0] - 2024-08-21
428

529
_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._
@@ -12,4 +36,5 @@ _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._
1236

1337
- **Breaking:** Added service-to-service request/response mechanism ([!9](https://github.com/INTERSECT-SDK/python-sdk/pull/9)) .
1438

39+
[0.8.0]: https://github.com/Level/level/releases/tag/0.8.0
1540
[0.7.0]: https://github.com/Level/level/releases/tag/0.7.0

UPGRADING.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,110 @@
22

33
This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md).
44

5+
## 0.8.0
6+
7+
### Service-2-Service callback function
8+
9+
The SDK will now provide the callback function with four arguments instead of one. The message payload was originally the only argument, and is now the fourth argument; the value of this will remain unchanged.
10+
11+
For example, in the following example, you will need to change service_response_handler's function definition from:
12+
13+
```python
14+
class Capability(IntersectBaseCapabilityImplementation):
15+
@intersect_message()
16+
def service_call_function(self, text: str) -> None:
17+
msg_to_send = IntersectDirectMessageParams(
18+
destination='example-organization.example-facility.example-system.example-subsystem.service-two',
19+
operation='ServiceTwo.test_service',
20+
payload=text,
21+
)
22+
23+
# Send intersect message to another service
24+
self.intersect_sdk_call_service(msg_to_send, self.service_response_handler)
25+
26+
@intersect_event(events={'response_event': IntersectEventDefinition(event_type=str)})
27+
def service_response_handler(self, msg: Any) -> None:
28+
# handle response msg
29+
```
30+
31+
to
32+
33+
```python
34+
class Capability(IntersectBaseCapabilityImplementation):
35+
@intersect_message()
36+
def service_call_function(self, text: str) -> None:
37+
msg_to_send = IntersectDirectMessageParams(
38+
destination='example-organization.example-facility.example-system.example-subsystem.service-two',
39+
operation='ServiceTwo.test_service',
40+
payload=text,
41+
)
42+
43+
# Send intersect message to another service
44+
self.intersect_sdk_call_service(msg_to_send, self.service_response_handler)
45+
46+
@intersect_event(events={'response_event': IntersectEventDefinition(event_type=str)})
47+
def service_response_handler(self, _source: str, _operation: str, _has_error: bool, msg: Any) -> None:
48+
# handle response msg
49+
```
50+
51+
### Capability names
52+
53+
On a Capability class, `capability_name` has been changed to `intersect_sdk_capability_name`, to explicitly keep intersect-sdk constructs in the `intersect_sdk_` namespace. With this convention, you should also avoid creating variables or functions which begin with `intersect_sdk_` .
54+
55+
If your capability name contained any characters other than alphanumerics, underscores, and hyphens, it is no longer valid (for example: spaces are not accepted).
56+
57+
A breaking change involves how the capability name is set; this is to allow for schema generation without instantiating a capability instance (which may involve external dependencies). You CANNOT do this on an instance anymore:
58+
59+
```python
60+
class Capability(IntersectBaseCapabilityImplementation):
61+
...
62+
63+
if __name__ == '__main__':
64+
instance = Capability()
65+
# DON'T DO THIS - THIS WILL NOT WORK
66+
instance.intersect_sdk_capability_name = 'MyCapability'
67+
```
68+
69+
The most idiomatic way to set `intersect_sdk_capability_name` is as a class variable:
70+
71+
```python
72+
class Capability(IntersectBaseCapabilityImplementation):
73+
intersect_sdk_capability_name = 'MyCapability'
74+
75+
# still have total freedom to modify the constructor parameters
76+
def __init__(self):
77+
...
78+
79+
@intersect_message
80+
def example_class_function(self, req: str) -> str:
81+
...
82+
83+
if __name__ == '__main__':
84+
instance = Capability()
85+
# no need to further modify the instance or the class
86+
config = IntersectServiceConfig(
87+
# ... omitted for brevity
88+
)
89+
service = IntersectService([instance], config)
90+
```
91+
92+
It is still possible to modify the _class variable_ of the Capability at runtime, as long as you do not create the Service instance yet:
93+
94+
```python
95+
class Capability(IntersectBaseCapabilityImplementation):
96+
...
97+
98+
if __name__ == '__main__':
99+
instance = Capability()
100+
# no need to further modify the instance or the class
101+
config = IntersectServiceConfig(
102+
# ... omitted for brevity
103+
)
104+
Capability.intersect_sdk_capability_name = os.environ.get('CAPABILITY_NAME') # ok
105+
# make sure the class variable is set before creating the instance
106+
service = IntersectService([instance], config)
107+
```
108+
5109
## 0.7.0
6110

7111
### Services

examples/1_hello_world/hello_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
66
"description": "INTERSECT schema",

examples/1_hello_world_amqp/hello_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
66
"description": "INTERSECT schema",

examples/1_hello_world_events/hello_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
66
"description": "INTERSECT schema",

examples/1_hello_world_minio/hello_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
66
"description": "INTERSECT schema",

examples/2_counting/counting_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "counting-organization.counting-facility.counting-system.counting-subsystem.counting-service",
66
"description": "INTERSECT schema",

examples/2_counting_events/counting_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "counting-organization.counting-facility.counting-system.counting-subsystem.counting-service",
66
"description": "INTERSECT schema",

examples/3_ping_pong_events/ping_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.ping-service",
66
"description": "INTERSECT schema",

examples/3_ping_pong_events/pong_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.pong-service",
66
"description": "INTERSECT schema",

examples/3_ping_pong_events_amqp/ping_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.ping-service",
66
"description": "INTERSECT schema",

examples/3_ping_pong_events_amqp/pong_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.pong-service",
66
"description": "INTERSECT schema",

examples/4_service_to_service/example_1_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "example-organization.example-facility.example-system.example-subsystem.service-one",
66
"description": "INTERSECT schema",

examples/4_service_to_service/example_2_service_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "example-organization.example-facility.example-system.example-subsystem.service-two",
66
"description": "INTERSECT schema",

src/intersect_sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ._internal.version import strip_version_metadata
99

1010
# may include build metadata
11-
__version__ = '0.7.0'
11+
__version__ = '0.8.0'
1212

1313
version_string = strip_version_metadata(__version__)
1414
"""

tests/fixtures/example_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"asyncapi": "2.6.0",
3-
"x-intersect-version": "0.7.0",
3+
"x-intersect-version": "0.8.0",
44
"info": {
55
"title": "test.test.test.test.test",
66
"description": "INTERSECT schema",

0 commit comments

Comments
 (0)