diff --git a/CHANGELOG.md b/CHANGELOG.md index d0aee41..37047c0 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 diff --git a/README.md b/README.md index 6efd4ea..1103468 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 @@ -32,7 +33,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 +56,8 @@ requests.post("", data=body, headers=headers) ### Structured HTTP CloudEvent ```python -from cloudevents.http import CloudEvent, to_structured +from cloudevents.conversion import to_structured +from cloudevents.http import CloudEvent import requests # Create a CloudEvent @@ -73,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 @@ -107,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 @@ -144,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. diff --git a/cloudevents/__init__.py b/cloudevents/__init__.py index 91d1973..0b4636c 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" diff --git a/samples/http-image-cloudevents/client.py b/samples/http-image-cloudevents/client.py index 70a3477..021c1f5 100644 --- a/samples/http-image-cloudevents/client.py +++ b/samples/http-image-cloudevents/client.py @@ -16,7 +16,8 @@ import sys import requests -from cloudevents.http import CloudEvent, to_binary, to_structured +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 ace9f1c..5fe6ec9 100644 --- a/samples/http-image-cloudevents/image_sample_test.py +++ b/samples/http-image-cloudevents/image_sample_test.py @@ -21,7 +21,8 @@ from client import image_bytes from image_sample_server import app from PIL import Image -from cloudevents.http import CloudEvent, from_http, to_binary, to_structured +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 0bc7d27..5ecc379 100644 --- a/samples/http-json-cloudevents/client.py +++ b/samples/http-json-cloudevents/client.py @@ -16,7 +16,8 @@ import sys import requests -from cloudevents.http import CloudEvent, to_binary, to_structured +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 4f01acb..1d92874 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.conversion import to_binary, to_structured +from cloudevents.http import CloudEvent @pytest.fixture