Skip to content

release: v1.6.0 #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion cloudevents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.

__version__ = "1.5.0"
__version__ = "1.6.0"
3 changes: 2 additions & 1 deletion samples/http-image-cloudevents/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

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
Expand Down
3 changes: 2 additions & 1 deletion samples/http-image-cloudevents/image_sample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.conversion import to_binary, to_structured
from cloudevents.http import CloudEvent, from_http

image_fileobj = io.BytesIO(image_bytes)
image_expected_shape = (1880, 363)
Expand Down
3 changes: 2 additions & 1 deletion samples/http-json-cloudevents/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

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):
Expand Down
3 changes: 2 additions & 1 deletion samples/http-json-cloudevents/json_sample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down