Skip to content

Commit

Permalink
prepare v0.8.0 release
Browse files Browse the repository at this point in the history
Signed-off-by: Lance Drane <dranelt@ornl.gov>
  • Loading branch information
Lance-Drane committed Sep 11, 2024
1 parent 1753a2c commit a74b63d
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 14 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## Unreleased

## [0.8.0] - 2024-09-10

_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._

### Changed

- **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)) .
- **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)) .
- **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)) .

### Fixed

- Fixed issue with multiple service-to-service calls causing thread deadlocking ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/51ba9a8e0eb8c314014655bb0c989f5f98db715d)) .
- Correctly incorporates capabilities into internal schema generation ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .
- Removed MINIO from examples which do not use MINIO ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .

### Added

- **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)) .
- 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)) .
- Added an example which uses MINIO ([commit](https://github.com/INTERSECT-SDK/python-sdk/commit/1753a2cce1344a101c7cc41f91c6ed3467b1be52)) .

## [0.7.0] - 2024-08-21

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

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

[0.8.0]: https://github.com/Level/level/releases/tag/0.8.0
[0.7.0]: https://github.com/Level/level/releases/tag/0.7.0
104 changes: 104 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,110 @@

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).

## 0.8.0

### Service-2-Service callback function

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.

For example, in the following example, you will need to change service_response_handler's function definition from:

```python
class Capability(IntersectBaseCapabilityImplementation):
@intersect_message()
def service_call_function(self, text: str) -> None:
msg_to_send = IntersectDirectMessageParams(
destination='example-organization.example-facility.example-system.example-subsystem.service-two',
operation='ServiceTwo.test_service',
payload=text,
)

# Send intersect message to another service
self.intersect_sdk_call_service(msg_to_send, self.service_response_handler)

@intersect_event(events={'response_event': IntersectEventDefinition(event_type=str)})
def service_response_handler(self, msg: Any) -> None:
# handle response msg
```

to

```python
class Capability(IntersectBaseCapabilityImplementation):
@intersect_message()
def service_call_function(self, text: str) -> None:
msg_to_send = IntersectDirectMessageParams(
destination='example-organization.example-facility.example-system.example-subsystem.service-two',
operation='ServiceTwo.test_service',
payload=text,
)

# Send intersect message to another service
self.intersect_sdk_call_service(msg_to_send, self.service_response_handler)

@intersect_event(events={'response_event': IntersectEventDefinition(event_type=str)})
def service_response_handler(self, _source: str, _operation: str, _has_error: bool, msg: Any) -> None:
# handle response msg
```

### Capability names

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_` .

If your capability name contained any characters other than alphanumerics, underscores, and hyphens, it is no longer valid (for example: spaces are not accepted).

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:

```python
class Capability(IntersectBaseCapabilityImplementation):
...

if __name__ == '__main__':
instance = Capability()
# DON'T DO THIS - THIS WILL NOT WORK
instance.intersect_sdk_capability_name = 'MyCapability'
```

The most idiomatic way to set `intersect_sdk_capability_name` is as a class variable:

```python
class Capability(IntersectBaseCapabilityImplementation):
intersect_sdk_capability_name = 'MyCapability'

# still have total freedom to modify the constructor parameters
def __init__(self):
...

@intersect_message
def example_class_function(self, req: str) -> str:
...

if __name__ == '__main__':
instance = Capability()
# no need to further modify the instance or the class
config = IntersectServiceConfig(
# ... omitted for brevity
)
service = IntersectService([instance], config)
```

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:

```python
class Capability(IntersectBaseCapabilityImplementation):
...

if __name__ == '__main__':
instance = Capability()
# no need to further modify the instance or the class
config = IntersectServiceConfig(
# ... omitted for brevity
)
Capability.intersect_sdk_capability_name = os.environ.get('CAPABILITY_NAME') # ok
# make sure the class variable is set before creating the instance
service = IntersectService([instance], config)
```

## 0.7.0

### Services
Expand Down
2 changes: 1 addition & 1 deletion examples/1_hello_world/hello_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/1_hello_world_amqp/hello_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/1_hello_world_events/hello_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/1_hello_world_minio/hello_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "hello-organization.hello-facility.hello-system.hello-subsystem.hello-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/2_counting/counting_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "counting-organization.counting-facility.counting-system.counting-subsystem.counting-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/2_counting_events/counting_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "counting-organization.counting-facility.counting-system.counting-subsystem.counting-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/3_ping_pong_events/ping_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.ping-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/3_ping_pong_events/pong_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.pong-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/3_ping_pong_events_amqp/ping_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.ping-service",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion examples/3_ping_pong_events_amqp/pong_service_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "p-ng-organization.p-ng-facility.p-ng-system.p-ng-subsystem.pong-service",
"description": "INTERSECT schema",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "example-organization.example-facility.example-system.example-subsystem.service-one",
"description": "INTERSECT schema",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "example-organization.example-facility.example-system.example-subsystem.service-two",
"description": "INTERSECT schema",
Expand Down
2 changes: 1 addition & 1 deletion src/intersect_sdk/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ._internal.version import strip_version_metadata

# may include build metadata
__version__ = '0.7.0'
__version__ = '0.8.0'

version_string = strip_version_metadata(__version__)
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/example_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asyncapi": "2.6.0",
"x-intersect-version": "0.7.0",
"x-intersect-version": "0.8.0",
"info": {
"title": "test.test.test.test.test",
"description": "INTERSECT schema",
Expand Down

0 comments on commit a74b63d

Please sign in to comment.