Skip to content

Commit 75c0373

Browse files
chore: v2 upgrade tooling (#257)
* refactor(config): update dependencies and dev tools versions Signed-off-by: Yurii Serhiichuk <[email protected]> * refactor(workflows): update GitHub Actions and OS versions in workflows Signed-off-by: Yurii Serhiichuk <[email protected]> * docs(releasing): simplify and update releasing guidelines Signed-off-by: Yurii Serhiichuk <[email protected]> * docs(github): enhance pull request template with detailed guidelines and checklist Signed-off-by: Yurii Serhiichuk <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Yurii Serhiichuk <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fd6f579 commit 75c0373

File tree

10 files changed

+356
-185
lines changed

10 files changed

+356
-185
lines changed

.github/pull_request_template.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1-
Fixes #<issuelink>
1+
<!--
2+
Thank you for contributing to the project!
23
3-
## Changes
4+
Please make sure to read the `CONTRIBUTING.md` file for our contribution guidelines:
5+
https://github.com/cloudevents/sdk-python/blob/main/CONTRIBUTING.md
6+
-->
47

8+
<!--
9+
Please provide a clear and concise description of the pull request.
10+
-->
511

6-
## One line description for the changelog
12+
**Related Issue:** #<issue_number>
713

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

9-
- [ ] Tests pass
10-
- [ ] Appropriate changes to README are included in PR
24+
**Description:**
25+
<!--
26+
Please include a summary of the change and which issue is fixed.
27+
Please also include relevant motivation and context.
28+
List any dependencies that are required for this change.
29+
-->
30+
31+
---
32+
33+
**Pre-submission checklist:**
34+
- [ ] I have read the [CONTRIBUTING.md](https://github.com/cloudevents/sdk-python/blob/main/CONTRIBUTING.md) file.
35+
- [ ] I have signed off my commits using `git commit --signoff`.
36+
- [ ] I have added tests that prove my fix is effective or that my feature works.
37+
- [ ] I have updated the documentation (`README.md`, `CHANGELOG.md`, etc.) as necessary.
38+
- [ ] I have run `pre-commit` and `tox` and all checks pass.
39+
- [ ] This pull request is ready to be reviewed.

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
os: [ubuntu-latest, windows-latest, macos-latest]
2727
runs-on: ${{ matrix.os }}
2828
steps:
29-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v5
3030
- name: Install uv
31-
uses: astral-sh/setup-uv@v2
31+
uses: astral-sh/setup-uv@v7
3232
with:
3333
enable-cache: true
3434
cache-dependency-glob: "uv.lock"

.github/workflows/pypi-release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,38 @@ on:
1010
jobs:
1111
build_dist:
1212
name: Build source distribution
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-24.04
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Build SDist and wheel
2020
run: pipx run build
2121

22-
- uses: actions/upload-artifact@v4
22+
- uses: actions/upload-artifact@v5
2323
with:
2424
name: artifact
2525
path: dist/*
2626

2727
- name: Check metadata
2828
run: pipx run twine check dist/*
2929
publish:
30-
runs-on: ubuntu-22.04
30+
runs-on: ubuntu-24.04
3131
if: github.event_name == 'push'
3232
needs: [ build_dist ]
3333
steps:
34-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@v5
3535
with:
3636
fetch-depth: 0
3737
- name: Set up Python
38-
uses: actions/setup-python@v4
38+
uses: actions/setup-python@v6
3939
with:
4040
python-version: "3.11"
4141
cache: 'pip'
4242
- name: Install build dependencies
4343
run: pip install -U setuptools wheel build
44-
- uses: actions/download-artifact@v4
44+
- uses: actions/download-artifact@v5
4545
with:
4646
# unpacks default artifact into dist/
4747
# if `name: artifact` is omitted, the action will create extra parent dir

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v6.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
77
- id: check-toml
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.6.8
9+
rev: v0.14.10
1010
hooks:
1111
# Run the linter.
1212
- id: ruff
1313
# Run the formatter.
1414
- id: ruff-format
1515
- repo: https://github.com/pre-commit/mirrors-mypy
16-
rev: v1.11.2
16+
rev: v1.19.1
1717
hooks:
1818
- id: mypy
1919
files: ^(src/cloudevents/|tests/)
2020
exclude: ^(src/cloudevents/v1/)
2121
types: [python]
2222
args: ["--config-file=pyproject.toml"]
2323
additional_dependencies:
24-
- types-python-dateutil>=2.9.0.20241003
24+
- types-python-dateutil>=2.9.0.20251115

RELEASING.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,15 @@ This repository is configured to automatically publish the corresponding [PyPI
44
package](https://pypi.org/project/cloudevents/) and GitHub Tag via GitHub Actions.
55

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

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

2417
View the GitHub workflow [pypi-release.yml](.github/workflows/pypi-release.yml) for
2518
more information.

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ keywords = [
3232
"Serverless",
3333
]
3434
dependencies = [
35-
"ruff>=0.6.8",
3635
"python-dateutil>=2.8.2",
3736
]
3837

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

4847
[dependency-groups]
4948
dev = [
50-
"pytest>=8.3.3",
51-
"mypy>=1.11.2",
52-
"isort>=5.13.2",
53-
"flake8>=7.1.1",
54-
"pep8-naming>=0.14.1",
49+
"ruff>=0.14.10",
50+
"pytest>=9.0.2",
51+
"mypy>=1.19.1",
52+
"isort>=7.0.0",
53+
"flake8>=7.3.0",
54+
"pep8-naming>=0.15.1",
5555
"flake8-print>=5.0.0",
56-
"pre-commit>=3.8.0",
57-
"pytest-cov>=5.0.0",
58-
"types-python-dateutil>=2.9.0.20241003",
56+
"pre-commit>=4.5.1",
57+
"pytest-cov>=7.0.0",
58+
"types-python-dateutil>=2.9.0.20251115",
5959
]
6060

6161
[tool.uv.pip]

src/cloudevents/v1/kafka/conversion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def from_structured(
228228
structure = envelope_unmarshaller(message.value)
229229
except Exception as e:
230230
raise cloud_exceptions.DataUnmarshallerError(
231-
"Failed to unmarshall message with error: " f"{type(e).__name__}('{e}')"
231+
f"Failed to unmarshall message with error: {type(e).__name__}('{e}')"
232232
)
233233

234234
attributes: typing.Dict[str, typing.Any] = {}
@@ -247,7 +247,7 @@ def from_structured(
247247
decoded_value = value
248248
except Exception as e:
249249
raise cloud_exceptions.DataUnmarshallerError(
250-
"Failed to unmarshall data with error: " f"{type(e).__name__}('{e}')"
250+
f"Failed to unmarshall data with error: {type(e).__name__}('{e}')"
251251
)
252252
if name == "data":
253253
data = decoded_value

src/cloudevents/v1/sdk/event/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@ def UnmarshalJSON(
245245
decoded_value = value
246246
except Exception as e:
247247
raise cloud_exceptions.DataUnmarshallerError(
248-
"Failed to unmarshall data with error: "
249-
f"{type(e).__name__}('{e}')"
248+
f"Failed to unmarshall data with error: {type(e).__name__}('{e}')"
250249
)
251250
self.Set(name, decoded_value)
252251

src/cloudevents/v1/sdk/exceptions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(self, converter_type):
3636
class UnsupportedEventConverter(Exception):
3737
def __init__(self, content_type):
3838
super().__init__(
39-
"Unable to identify valid event converter "
40-
"for content-type: '{0}'".format(content_type)
39+
"Unable to identify valid event converter for content-type: '{0}'".format(
40+
content_type
41+
)
4142
)

0 commit comments

Comments
 (0)