From 7d8acf774ec304cdbbbccfa5f076dc9aaab34998 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Wed, 17 Aug 2022 22:02:06 +0300 Subject: [PATCH 1/7] chore: bump version. Signed-off-by: Yurii Serhiichuk --- cloudevents/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudevents/__init__.py b/cloudevents/__init__.py index 91d19737..0b4636c5 100644 --- a/cloudevents/__init__.py +++ b/cloudevents/__init__.py @@ -12,4 +12,4 @@ # License for the specific language governing permissions and limitations # under the License. -__version__ = "1.5.0" +__version__ = "1.6.0" From a8cd8afa8974943f515b17957b494d91d8fc56a8 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Wed, 17 Aug 2022 22:02:21 +0300 Subject: [PATCH 2/7] docs: Update changelog with the release Signed-off-by: Yurii Serhiichuk --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0aee410..37047c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.6.0] — 2022-08-17 ### Added - A new `CloudEvent` optional `pydantic` model class is available in the `cloudevents.pydantic.event` module. The new model enables the integration of @@ -141,6 +142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial release +[1.6.0]: https://github.com/cloudevents/sdk-python/compare/1.5.0...1.6.0 [1.5.0]: https://github.com/cloudevents/sdk-python/compare/1.4.0...1.5.0 [1.4.0]: https://github.com/cloudevents/sdk-python/compare/1.3.0...1.4.0 [1.3.0]: https://github.com/cloudevents/sdk-python/compare/1.2.0...1.3.0 From 079b0fdf61840d3a3339611617a9e2fd9ae44052 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Wed, 17 Aug 2022 22:09:33 +0300 Subject: [PATCH 3/7] docs: Use new `conversion` module over deprecated APIs. Signed-off-by: Yurii Serhiichuk --- README.md | 6 ++++-- samples/http-image-cloudevents/client.py | 3 ++- samples/http-image-cloudevents/image_sample_test.py | 3 ++- samples/http-json-cloudevents/client.py | 3 ++- samples/http-json-cloudevents/json_sample_test.py | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6efd4ea9..0f774730 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Below we will provide samples on how to send cloudevents using the popular ### Binary HTTP CloudEvent ```python -from cloudevents.http import CloudEvent, to_binary +from cloudevents.http import CloudEvent +from cloudevents.conversion import to_binary import requests # Create a CloudEvent @@ -54,7 +55,8 @@ requests.post("", data=body, headers=headers) ### Structured HTTP CloudEvent ```python -from cloudevents.http import CloudEvent, to_structured +from cloudevents.http import CloudEvent +from cloudevents.conversion import to_structured import requests # Create a CloudEvent diff --git a/samples/http-image-cloudevents/client.py b/samples/http-image-cloudevents/client.py index 70a3477f..ed483cc8 100644 --- a/samples/http-image-cloudevents/client.py +++ b/samples/http-image-cloudevents/client.py @@ -16,7 +16,8 @@ import requests -from cloudevents.http import CloudEvent, to_binary, to_structured +from cloudevents.http import CloudEvent +from cloudevents.conversion import to_binary, to_structured resp = requests.get( "https://raw.githubusercontent.com/cncf/artwork/master/projects/cloudevents/horizontal/color/cloudevents-horizontal-color.png" # noqa diff --git a/samples/http-image-cloudevents/image_sample_test.py b/samples/http-image-cloudevents/image_sample_test.py index ace9f1cb..061f9cfc 100644 --- a/samples/http-image-cloudevents/image_sample_test.py +++ b/samples/http-image-cloudevents/image_sample_test.py @@ -21,7 +21,8 @@ from image_sample_server import app from PIL import Image -from cloudevents.http import CloudEvent, from_http, to_binary, to_structured +from cloudevents.http import CloudEvent, from_http +from cloudevents.conversion import to_binary, to_structured image_fileobj = io.BytesIO(image_bytes) image_expected_shape = (1880, 363) diff --git a/samples/http-json-cloudevents/client.py b/samples/http-json-cloudevents/client.py index 0bc7d27c..01ba6ba7 100644 --- a/samples/http-json-cloudevents/client.py +++ b/samples/http-json-cloudevents/client.py @@ -16,7 +16,8 @@ import requests -from cloudevents.http import CloudEvent, to_binary, to_structured +from cloudevents.http import CloudEvent +from cloudevents.conversion import to_binary, to_structured def send_binary_cloud_event(url): diff --git a/samples/http-json-cloudevents/json_sample_test.py b/samples/http-json-cloudevents/json_sample_test.py index 4f01acbc..fab7a849 100644 --- a/samples/http-json-cloudevents/json_sample_test.py +++ b/samples/http-json-cloudevents/json_sample_test.py @@ -15,7 +15,8 @@ import pytest from json_sample_server import app -from cloudevents.http import CloudEvent, to_binary, to_structured +from cloudevents.http import CloudEvent +from cloudevents.conversion import to_binary, to_structured @pytest.fixture From 1e9bdaf254e1edb63e30447e5033250ff3c159dd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 19:12:08 +0000 Subject: [PATCH 4/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- samples/http-image-cloudevents/client.py | 2 +- samples/http-image-cloudevents/image_sample_test.py | 2 +- samples/http-json-cloudevents/client.py | 2 +- samples/http-json-cloudevents/json_sample_test.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/http-image-cloudevents/client.py b/samples/http-image-cloudevents/client.py index ed483cc8..021c1f56 100644 --- a/samples/http-image-cloudevents/client.py +++ b/samples/http-image-cloudevents/client.py @@ -16,8 +16,8 @@ import requests -from cloudevents.http import CloudEvent from cloudevents.conversion import to_binary, to_structured +from cloudevents.http import CloudEvent resp = requests.get( "https://raw.githubusercontent.com/cncf/artwork/master/projects/cloudevents/horizontal/color/cloudevents-horizontal-color.png" # noqa diff --git a/samples/http-image-cloudevents/image_sample_test.py b/samples/http-image-cloudevents/image_sample_test.py index 061f9cfc..5fe6ec9d 100644 --- a/samples/http-image-cloudevents/image_sample_test.py +++ b/samples/http-image-cloudevents/image_sample_test.py @@ -21,8 +21,8 @@ from image_sample_server import app from PIL import Image -from cloudevents.http import CloudEvent, from_http from cloudevents.conversion import to_binary, to_structured +from cloudevents.http import CloudEvent, from_http image_fileobj = io.BytesIO(image_bytes) image_expected_shape = (1880, 363) diff --git a/samples/http-json-cloudevents/client.py b/samples/http-json-cloudevents/client.py index 01ba6ba7..5ecc3793 100644 --- a/samples/http-json-cloudevents/client.py +++ b/samples/http-json-cloudevents/client.py @@ -16,8 +16,8 @@ import requests -from cloudevents.http import CloudEvent from cloudevents.conversion import to_binary, to_structured +from cloudevents.http import CloudEvent def send_binary_cloud_event(url): diff --git a/samples/http-json-cloudevents/json_sample_test.py b/samples/http-json-cloudevents/json_sample_test.py index fab7a849..1d92874d 100644 --- a/samples/http-json-cloudevents/json_sample_test.py +++ b/samples/http-json-cloudevents/json_sample_test.py @@ -15,8 +15,8 @@ import pytest from json_sample_server import app -from cloudevents.http import CloudEvent from cloudevents.conversion import to_binary, to_structured +from cloudevents.http import CloudEvent @pytest.fixture From 926d829916df60d5a19e9b148687445eac7046ff Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Wed, 17 Aug 2022 22:13:33 +0300 Subject: [PATCH 5/7] docs: Also sort imports in README Signed-off-by: Yurii Serhiichuk --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f774730..222a0c63 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,8 @@ requests.post("", data=body, headers=headers) ### Structured HTTP CloudEvent ```python -from cloudevents.http import CloudEvent from cloudevents.conversion import to_structured +from cloudevents.http import CloudEvent import requests # Create a CloudEvent From 56724c320d10615d7b5b3eba0a8bee45918cb893 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Wed, 17 Aug 2022 22:16:17 +0300 Subject: [PATCH 6/7] docs: cleanup README and refereance latest Flask Signed-off-by: Yurii Serhiichuk --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 222a0c63..60007bc7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ This SDK current supports the following versions of CloudEvents: ## Python SDK -Package **cloudevents** provides primitives to work with CloudEvents specification: https://github.com/cloudevents/spec. +Package **cloudevents** provides primitives to work with CloudEvents specification: +https://github.com/cloudevents/spec. ### Installing @@ -75,12 +76,13 @@ headers, body = to_structured(event) requests.post("", data=body, headers=headers) ``` -You can find a complete example of turning a CloudEvent into a HTTP request [in the samples directory](samples/http-json-cloudevents/client.py). +You can find a complete example of turning a CloudEvent into a HTTP request +[in the samples' directory](samples/http-json-cloudevents/client.py). ## Receiving CloudEvents The code below shows how to consume a cloudevent using the popular python web framework -[flask](https://flask.palletsprojects.com/en/1.1.x/quickstart/): +[flask](https://flask.palletsprojects.com/en/2.2.x/quickstart/): ```python from flask import Flask, request @@ -109,15 +111,18 @@ if __name__ == "__main__": app.run(port=3000) ``` -You can find a complete example of turning a CloudEvent into a HTTP request [in the samples directory](samples/http-json-cloudevents/json_sample_server.py). +You can find a complete example of turning a CloudEvent into a HTTP request +[in the samples' directory](samples/http-json-cloudevents/json_sample_server.py). ## SDK versioning -The goal of this package is to provide support for all released versions of CloudEvents, ideally while maintaining -the same API. It will use semantic versioning with following rules: +The goal of this package is to provide support for all released versions of CloudEvents, +ideally while maintaining the same API. It will use semantic versioning +with following rules: - MAJOR version increments when backwards incompatible changes is introduced. -- MINOR version increments when backwards compatible feature is introduced INCLUDING support for new CloudEvents version. +- MINOR version increments when backwards compatible feature is introduced + INCLUDING support for new CloudEvents version. - PATCH version increments when a backwards compatible bug fix is introduced. ## Community @@ -146,8 +151,8 @@ information. ## Maintenance -We use [black][black] and [isort][isort] for autoformatting. We set up a [tox][tox] environment -to reformat the codebase. +We use [black][black] and [isort][isort] for autoformatting. We set up a [tox][tox] +environment to reformat the codebase. e.g. From e1d6cf86625206c026807cc8b3ed95b34c056c49 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 19:17:00 +0000 Subject: [PATCH 7/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 60007bc7..1103468e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This SDK current supports the following versions of CloudEvents: ## Python SDK -Package **cloudevents** provides primitives to work with CloudEvents specification: +Package **cloudevents** provides primitives to work with CloudEvents specification: https://github.com/cloudevents/spec. ### Installing @@ -76,7 +76,7 @@ headers, body = to_structured(event) requests.post("", data=body, headers=headers) ``` -You can find a complete example of turning a CloudEvent into a HTTP request +You can find a complete example of turning a CloudEvent into a HTTP request [in the samples' directory](samples/http-json-cloudevents/client.py). ## Receiving CloudEvents @@ -111,17 +111,17 @@ if __name__ == "__main__": app.run(port=3000) ``` -You can find a complete example of turning a CloudEvent into a HTTP request +You can find a complete example of turning a CloudEvent into a HTTP request [in the samples' directory](samples/http-json-cloudevents/json_sample_server.py). ## SDK versioning -The goal of this package is to provide support for all released versions of CloudEvents, -ideally while maintaining the same API. It will use semantic versioning +The goal of this package is to provide support for all released versions of CloudEvents, +ideally while maintaining the same API. It will use semantic versioning with following rules: - MAJOR version increments when backwards incompatible changes is introduced. -- MINOR version increments when backwards compatible feature is introduced +- MINOR version increments when backwards compatible feature is introduced INCLUDING support for new CloudEvents version. - PATCH version increments when a backwards compatible bug fix is introduced. @@ -151,7 +151,7 @@ information. ## Maintenance -We use [black][black] and [isort][isort] for autoformatting. We set up a [tox][tox] +We use [black][black] and [isort][isort] for autoformatting. We set up a [tox][tox] environment to reformat the codebase. e.g.