Skip to content
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
39 changes: 34 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
Fixes #<issuelink>
<!--
Thank you for contributing to the project!

## Changes
Please make sure to read the `CONTRIBUTING.md` file for our contribution guidelines:
https://github.com/cloudevents/sdk-python/blob/main/CONTRIBUTING.md
-->

<!--
Please provide a clear and concise description of the pull request.
-->

## One line description for the changelog
**Related Issue:** #<issue_number>

**Type of change:**
<!--
Please select one of the following options and delete the others.
-->
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update
- Other (please describe):

- [ ] Tests pass
- [ ] Appropriate changes to README are included in PR
**Description:**
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
-->

---

**Pre-submission checklist:**
- [ ] I have read the [CONTRIBUTING.md](https://github.com/cloudevents/sdk-python/blob/main/CONTRIBUTING.md) file.
- [ ] I have signed off my commits using `git commit --signoff`.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have updated the documentation (`README.md`, `CHANGELOG.md`, etc.) as necessary.
- [ ] I have run `pre-commit` and `tox` and all checks pass.
- [ ] This pull request is ready to be reviewed.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ on:
jobs:
build_dist:
name: Build source distribution
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Build SDist and wheel
run: pipx run build

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: artifact
path: dist/*

- name: Check metadata
run: pipx run twine check dist/*
publish:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event_name == 'push'
needs: [ build_dist ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: 'pip'
- name: Install build dependencies
run: pip install -U setuptools wheel build
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.14.10
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.19.1
hooks:
- id: mypy
files: ^(src/cloudevents/|tests/)
exclude: ^(src/cloudevents/v1/)
types: [python]
args: ["--config-file=pyproject.toml"]
additional_dependencies:
- types-python-dateutil>=2.9.0.20241003
- types-python-dateutil>=2.9.0.20251115
23 changes: 8 additions & 15 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@ This repository is configured to automatically publish the corresponding [PyPI
package](https://pypi.org/project/cloudevents/) and GitHub Tag via GitHub Actions.

To release a new CloudEvents SDK, contributors should bump `__version__` in
[cloudevents](cloudevents_v1/__init__.py) to reflect the new release version. On merge, the action
will automatically build and release to PyPI using
[this PyPI GitHub Action](https://github.com/pypa/gh-action-pypi-publish). This
action gets called on all pushes to main (such as a version branch being merged
into main), but only releases a new version when the version number has changed. Note,
this action assumes pushes to main are version updates. Consequently,
[pypi-release.yml](.github/workflows/pypi-release.yml) will fail if you attempt to
push to main without updating `__version__` in
[cloudevents](cloudevents_v1/__init__.py) so don't forget to do so.
`src/cloudevents/__init__.py` to reflect the new release version. On merge, the action
will automatically build and release to PyPI. This action gets called on all pushes to main
(such as a version branch being merged into main), but only releases a new version when the
version number has changed. Note, this action assumes pushes to main are version updates.
Consequently, the release workflow will fail if you attempt to push to main without updating
`__version__` in `src/cloudevents/__init__.py` so don't forget to do so.

After a version update is merged, the script [pypi_packaging.py](pypi_packaging.py)
will create a GitHub tag for the new cloudevents version using `__version__`.
The script fails if `__version__` and the local pypi version for
cloudevents are out of sync. For this reason, [pypi-release.yml](.github/workflows/pypi-release.yml)
first must upload the new cloudevents pypi package, and then download the recently updated pypi
cloudevents package for [pypi_packaging.py](pypi_packaging.py) not to fail.
After a version update is merged, a GitHub tag for the new cloudevents version is created
using `__version__`.

View the GitHub workflow [pypi-release.yml](.github/workflows/pypi-release.yml) for
more information.
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ keywords = [
"Serverless",
]
dependencies = [
"ruff>=0.6.8",
"python-dateutil>=2.8.2",
]

Expand All @@ -47,15 +46,16 @@ build-backend = "hatchling.build"

[dependency-groups]
dev = [
"pytest>=8.3.3",
"mypy>=1.11.2",
"isort>=5.13.2",
"flake8>=7.1.1",
"pep8-naming>=0.14.1",
"ruff>=0.14.10",
"pytest>=9.0.2",
"mypy>=1.19.1",
"isort>=7.0.0",
"flake8>=7.3.0",
"pep8-naming>=0.15.1",
"flake8-print>=5.0.0",
"pre-commit>=3.8.0",
"pytest-cov>=5.0.0",
"types-python-dateutil>=2.9.0.20241003",
"pre-commit>=4.5.1",
"pytest-cov>=7.0.0",
"types-python-dateutil>=2.9.0.20251115",
]

[tool.uv.pip]
Expand Down
4 changes: 2 additions & 2 deletions src/cloudevents/v1/kafka/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def from_structured(
structure = envelope_unmarshaller(message.value)
except Exception as e:
raise cloud_exceptions.DataUnmarshallerError(
"Failed to unmarshall message with error: " f"{type(e).__name__}('{e}')"
f"Failed to unmarshall message with error: {type(e).__name__}('{e}')"
)

attributes: typing.Dict[str, typing.Any] = {}
Expand All @@ -247,7 +247,7 @@ def from_structured(
decoded_value = value
except Exception as e:
raise cloud_exceptions.DataUnmarshallerError(
"Failed to unmarshall data with error: " f"{type(e).__name__}('{e}')"
f"Failed to unmarshall data with error: {type(e).__name__}('{e}')"
)
if name == "data":
data = decoded_value
Expand Down
3 changes: 1 addition & 2 deletions src/cloudevents/v1/sdk/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ def UnmarshalJSON(
decoded_value = value
except Exception as e:
raise cloud_exceptions.DataUnmarshallerError(
"Failed to unmarshall data with error: "
f"{type(e).__name__}('{e}')"
f"Failed to unmarshall data with error: {type(e).__name__}('{e}')"
)
self.Set(name, decoded_value)

Expand Down
5 changes: 3 additions & 2 deletions src/cloudevents/v1/sdk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, converter_type):
class UnsupportedEventConverter(Exception):
def __init__(self, content_type):
super().__init__(
"Unable to identify valid event converter "
"for content-type: '{0}'".format(content_type)
"Unable to identify valid event converter for content-type: '{0}'".format(
content_type
)
)
Loading