diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8695b5a7..b19aaa26 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - run: pip install -r requirements.txt - run: pre-commit run --all-files - run: mypy kopf --strict @@ -38,7 +38,7 @@ jobs: fail-fast: false matrix: install-extras: [ "", "full-auth" ] - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} runs-on: ubuntu-22.04 timeout-minutes: 5 # usually 2-3 mins @@ -108,7 +108,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - uses: nolar/setup-k3d-k3s@v1 with: version: ${{ matrix.k3s }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1a3b25ef..994444cb 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - run: pip install --upgrade setuptools wheel twine - run: python setup.py sdist bdist_wheel - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/thorough.yaml b/.github/workflows/thorough.yaml index 88f589b9..63c2933b 100644 --- a/.github/workflows/thorough.yaml +++ b/.github/workflows/thorough.yaml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - run: pip install -r requirements.txt - run: pre-commit run --all-files - run: mypy kopf --strict @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: install-extras: [ "", "full-auth" ] - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} runs-on: ubuntu-22.04 timeout-minutes: 5 # usually 2-3 mins @@ -112,7 +112,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - uses: nolar/setup-k3d-k3s@v1 with: version: ${{ matrix.k3s }} @@ -134,7 +134,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - run: tools/install-minikube.sh - run: pip install -r requirements.txt -r examples/requirements.txt - run: pytest --color=yes --timeout=30 --only-e2e diff --git a/README.md b/README.md index 1d6a270a..836102b9 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ We assume that when the operator is executed in the cluster, it must be packaged into a docker image with a CI/CD tool of your preference. ```dockerfile -FROM python:3.7 +FROM python:3.11 ADD . /src RUN pip install kopf CMD kopf run /src/handlers.py --verbose diff --git a/docs/deployment.rst b/docs/deployment.rst index 6709ebc8..4569125b 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -10,13 +10,13 @@ But normally, the operators are usually deployed directly to the clusters. Docker image ============ -First of all, the operator must be packaged as a docker image with Python 3.7: +First of all, the operator must be packaged as a docker image with Python 3.7 or newer: .. code-block:: dockerfile :caption: Dockerfile :name: dockerfile - FROM python:3.7 + FROM python:3.11 ADD . /src RUN pip install kopf CMD kopf run /src/handlers.py --verbose diff --git a/kopf/_cogs/structs/diffs.py b/kopf/_cogs/structs/diffs.py index 7f6d6843..e3f76901 100644 --- a/kopf/_cogs/structs/diffs.py +++ b/kopf/_cogs/structs/diffs.py @@ -72,6 +72,10 @@ def __init__(self, __items: Iterable[DiffItem]): super().__init__() self._items = tuple(DiffItem(*item) for item in __items) + def __hash__(self) -> int: + # Hashes mark diffs as immutable to be usable as dataclasses' defaults in Python 3.11. + return hash(self._items) + def __repr__(self) -> str: return repr(self._items) diff --git a/setup.py b/setup.py index 2bf8ab4c..8117f9cf 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', diff --git a/tests/diffs/test_protocols.py b/tests/diffs/test_protocols.py index 862bcbd1..3eeb1064 100644 --- a/tests/diffs/test_protocols.py +++ b/tests/diffs/test_protocols.py @@ -53,3 +53,5 @@ def test_diff_comparison_to_the_same(): DiffItem(DiffOperation.REMOVE, ('key3',), 'old3', None), ]) assert d1 == d2 + assert hash(d1) == hash(d2) + assert d1 is not d2