release: v1.6.0 (#189)

* chore: bump version.

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* docs: Update changelog with the release

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* docs: Use new `conversion` module over deprecated APIs.

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: Also sort imports in README

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* docs: cleanup README and refereance latest Flask

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Yurii Serhiichuk 2022-08-18 17:24:20 +03:00 committed by GitHub
parent 8a88ffee10
commit 5e64e3fea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 16 deletions

View File

@ -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

View File

@ -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("<some-url>", 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("<some-url>", 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.

View File

@ -12,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
__version__ = "1.5.0"
__version__ = "1.6.0"

View File

@ -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

View File

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

View File

@ -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):

View File

@ -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