cdevents / sdk-python Goto Github PK
View Code? Open in Web Editor NEWPython SDK for CDEvents
License: Apache License 2.0
Python SDK for CDEvents
License: Apache License 2.0
As part of the Python lifecycle for packaging a python project, a pyproject.toml
is first required that outlines the overall project information and dependencies. This is equivalent to the POM file in a Java project that outlines the artifact information and package capabilities. We can first create the TOML file and then follow the steps to publish the SDK for public consumption.
Currently the GitHub workflows at https://github.com/cdevents/sdk-python/blob/skeleton-project/.github/workflows/main.yml are copied from a template and don't apply to the project.
The workflow for Pull requests should be updated to run two actions:
As we move to automated release for public use, we want to automatically create GitHub release and changelog as pull requests are approved/merged to main.
Following the method of the Java SDK, we should use the same bot and process to generate releases.
@erkist outlined, the next enhancement to the Python SDK would be to parse incoming events! Like in the CloudEvents Python SDK, they use Pydantic used for data parsing and validation. Issue is to track changes (for future changelog), conversations outside the pull request and any other feedback/input from the community!
Add a Make target for generating test coverage reports, using pytest-cov or similar
Good first issue
In the license file on line 189 the authors haven't been stated, this is a common thing that people miss when adding apache2 licenses.
change text to:
Copyright 2023 The cdevents Authors
When users open a pull request to the python SDK they should increment the version in the project file for github actions automation.
@erkist current pull request has the pre-commit checks failing. I have been researching the python errors and it appears to be a version change needs to be updated in the .pre-commit-config.yaml
file. I will work on making the change and open a pull request soon!
Users often interact with objects in json format.
Would it make sense to update this SDK so that users can easily transform json strings into objects whose types match those defined in the CDEvent spec?
We currently have some code that looks like this
some_json_str = '...' # this could be consumed from kafka or some http service
typed_msg = CDEventMsgFactory.from_json(some_json_str)
if isinstance(typed_msg, Taskrunstarted):
# do something...
elif isinstance(typed_msg, Taskrunfinished):
# do something...
etc...
Along with verifying that the json is valid, we can also do some additional checks, like checking enum values, as specified in the schema.
We can then also go back to json with something like
new_json_str = CDEventMsgFactory.to_json(typed_msg)
We wrote our own internal libraries, but we think it would be good to share this code, for others to re-use.
n/a
Write a simple README that shows how to get started with sdk-python and shows some usage examples.
Based on the updated binding document and schema, we shall create the python SDK under cdevents/sdk-python.
This includes investigating if/how the SDK can be generated from the json schema.
The Go SDK, and the CDEvents specification, has changed since the current iteration of the Python SDK was developed. The Python SDK should be updated to reflect these changes.
In preparation for releasing the python SDK, and following the release similar to java SDK, we need to setup an account for the cdevents-bot
on the PyPI site so we can use github actions to automate the release of the SDK with each release. @afrittoli do you mind following this link to setup an account for the bot and then setup an API token! Similar to the secrets.GH_BOT_TOKEN
used in the changelog github action, a new token like secrets.PYPI_BOT_TOKEN
could be used. Then I can create the automation and work on creating our first release using github actions. Source of how upload our python package.
Also there is no rush on this, with the CD Con next week, please take all the time you need! I'm still working on a few automation features while my teammate is working on the pydantic enhancements. Hope you have a great start to May!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.