cloudevents / sdk-python

Python SDK for CloudEvents
https://pypi.org/p/cloudevents/
Apache License 2.0
266 stars 53 forks source link

Pydantic v2 native implementation #219

Closed febus982 closed 10 months ago

febus982 commented 10 months ago

Fixes https://github.com/cloudevents/sdk-python/issues/215 Iterates over https://github.com/cloudevents/sdk-python/pull/218

Changes

Pydantic V2 implementation of CloudEvent class:

One line description for the changelog

Pydantic V2 implementation of CloudEvent class

febus982 commented 10 months ago

@xSAVIKx Here it is! I left comments in the parts with non-trivial changes.

One of them is a question for the last tiny piece of code still missing.

febus982 commented 10 months ago

Hey @xSAVIKx I addressed all the comments (I left them unresolved so you can double-check).

I don't think the typing error can be addressed because json.loads returns Any but we know well we're getting a dictionary there. I could add a check on the result being an instance of dict but I think adding a # type: ignore is safe enough. I'm also not sure why self is identified with a type and not an object, it might be a mypy issue. Let mw know if you have a better recommendation for this.

febus982 commented 10 months ago

@xSAVIKx Ready to be merged, all comments addressed.

benvdh-incentro commented 10 months ago

@xSAVIKx I noticed there hasn't been a release of the package since january 2023, though some very useful PRs (among them this one) got merged to main. I noticed the CI also fails on the fact that 1.9.0 already exists on PyPI, so likely it's just a version bump that's required.

So my question is: are there any plans to get this code released to PyPI ?

xSAVIKx commented 10 months ago

@xSAVIKx I noticed there hasn't been a release of the package since january 2023, though some very useful PRs (among them this one) got merged to main. I noticed the CI also fails on the fact that 1.9.0 already exists on PyPI, so likely it's just a version bump that's required.

So my question is: are there any plans to get this code released to PyPI ?

Hey @benvdh-incentro, sure thing 🙂 I was holding the release till this particular PR is implemented and we should get one probably on the weekend or early next week