diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 4cb248b..2b1dbf0 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -52,6 +52,7 @@ jobs: with: user: __token__ password: ${{ secrets.pypi_password }} + attestations: false - name: Install GitPython and cloudevents for pypi_packaging run: pip install -U -r requirements/publish.txt - name: Create Tag diff --git a/CHANGELOG.md b/CHANGELOG.md index 66dc58d..458a1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.11.1] + +### Fixed +- Kafka `conversion` marshaller and unmarshaller typings ([#240]) + +## [1.11.0] + +### Fixed +- Pydantic v2 `examples` keyword usage and improved typings handling ([#235]) +- Kafka `to_binary` check for invalid `content-type` attribute ([#232]) + ### Changed -- Dropped Python3.7 from CI while its EOL. +- Dropped Python3.7 from CI while its EOL. ([#236]) ## [1.10.1] @@ -194,6 +205,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial release +[1.11.0]: https://github.com/cloudevents/sdk-python/compare/1.10.1...1.11.0 [1.10.1]: https://github.com/cloudevents/sdk-python/compare/1.10.0...1.10.1 [1.10.0]: https://github.com/cloudevents/sdk-python/compare/1.9.0...1.10.0 [1.9.0]: https://github.com/cloudevents/sdk-python/compare/1.8.0...1.9.0 @@ -277,3 +289,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#219]: https://github.com/cloudevents/sdk-python/pull/219 [#221]: https://github.com/cloudevents/sdk-python/pull/221 [#229]: https://github.com/cloudevents/sdk-python/pull/229 +[#232]: https://github.com/cloudevents/sdk-python/pull/232 +[#235]: https://github.com/cloudevents/sdk-python/pull/235 +[#236]: https://github.com/cloudevents/sdk-python/pull/236 +[#240]: https://github.com/cloudevents/sdk-python/pull/240 diff --git a/cloudevents/__init__.py b/cloudevents/__init__.py index c6e1151..d332910 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.10.1" +__version__ = "1.11.1" diff --git a/cloudevents/kafka/conversion.py b/cloudevents/kafka/conversion.py index 97c355f..bfddca6 100644 --- a/cloudevents/kafka/conversion.py +++ b/cloudevents/kafka/conversion.py @@ -21,9 +21,14 @@ from cloudevents.kafka.exceptions import KeyMapperError from cloudevents.sdk import types -DEFAULT_MARSHALLER: types.MarshallerType = json.dumps -DEFAULT_UNMARSHALLER: types.MarshallerType = json.loads -DEFAULT_EMBEDDED_DATA_MARSHALLER: types.MarshallerType = lambda x: x +JSON_MARSHALLER: types.MarshallerType = json.dumps +JSON_UNMARSHALLER: types.UnmarshallerType = json.loads +IDENTITY_MARSHALLER = IDENTITY_UNMARSHALLER = lambda x: x + +DEFAULT_MARSHALLER: types.MarshallerType = JSON_MARSHALLER +DEFAULT_UNMARSHALLER: types.UnmarshallerType = JSON_UNMARSHALLER +DEFAULT_EMBEDDED_DATA_MARSHALLER: types.MarshallerType = IDENTITY_MARSHALLER +DEFAULT_EMBEDDED_DATA_UNMARSHALLER: types.UnmarshallerType = IDENTITY_UNMARSHALLER class KafkaMessage(typing.NamedTuple): @@ -109,7 +114,7 @@ def to_binary( def from_binary( message: KafkaMessage, event_type: typing.Optional[typing.Type[AnyCloudEvent]] = None, - data_unmarshaller: typing.Optional[types.MarshallerType] = None, + data_unmarshaller: typing.Optional[types.UnmarshallerType] = None, ) -> AnyCloudEvent: """ Returns a CloudEvent from a KafkaMessage in binary format. @@ -208,7 +213,7 @@ def to_structured( def from_structured( message: KafkaMessage, event_type: typing.Optional[typing.Type[AnyCloudEvent]] = None, - data_unmarshaller: typing.Optional[types.MarshallerType] = None, + data_unmarshaller: typing.Optional[types.UnmarshallerType] = None, envelope_unmarshaller: typing.Optional[types.UnmarshallerType] = None, ) -> AnyCloudEvent: """ @@ -222,7 +227,7 @@ def from_structured( :returns: CloudEvent """ - data_unmarshaller = data_unmarshaller or DEFAULT_EMBEDDED_DATA_MARSHALLER + data_unmarshaller = data_unmarshaller or DEFAULT_EMBEDDED_DATA_UNMARSHALLER envelope_unmarshaller = envelope_unmarshaller or DEFAULT_UNMARSHALLER try: structure = envelope_unmarshaller(message.value)