diff --git a/.github/workflows/python-tests.yaml b/.github/workflows/python-tests.yaml index 794e39ba61e3..8ccac2825e3b 100644 --- a/.github/workflows/python-tests.yaml +++ b/.github/workflows/python-tests.yaml @@ -1,5 +1,7 @@ name: Python tests +# Note: Conda support for 3.11 is pending. See https://github.com/ContinuumIO/anaconda-issues/issues/13082 + env: # enable colored output # https://github.com/pytest-dev/pytest/issues/7443 @@ -47,6 +49,7 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11" pytest-options: - "--exclude-services" - "--only-services" @@ -117,7 +120,8 @@ jobs: docker run --rm prefecthq/prefect:dev-python${{ matrix.python-version }} prefect version - name: Build Conda flavored test image - if: ${{ matrix.build-docker-images }} + # Not yet supported for 3.11, see note at top + if: ${{ matrix.build-docker-images && matrix.python-version != '3.11' }} uses: docker/build-push-action@v3 with: context: . @@ -132,7 +136,8 @@ jobs: # cache-to: type=gha,mode=max - name: Test Conda flavored Docker image - if: ${{ matrix.build-docker-images }} + # Not yet supported for 3.11, see note at top + if: ${{ matrix.build-docker-images && matrix.python-version != '3.11' }} run: | docker load --input /tmp/image-conda.tar docker run --rm prefecthq/prefect:dev-python${{ matrix.python-version }}-conda prefect version @@ -161,6 +166,7 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11" pytest-options: - "--exclude-services" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 23212caa4500..dd56a842cebd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,7 @@ name: Release prefect +# Note: Conda support for 3.11 is pending. See https://github.com/ContinuumIO/anaconda-issues/issues/13082 + on: push: tags: @@ -61,6 +63,7 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11" steps: # Not needed until we want multiarchecture builds @@ -122,6 +125,8 @@ jobs: - "3.8" - "3.9" - "3.10" + # Not yet supported, see note at top + # - "3.11" steps: # Not needed until we want multiarchecture builds @@ -270,6 +275,12 @@ jobs: name: release-image-${{ github.sha }}-3.10 path: /tmp/3.10/ + - name: Download image artifacts for Python 3.11 + uses: actions/download-artifact@v3 + with: + name: release-image-${{ github.sha }}-3.11 + path: /tmp/3.11/ + - name: Download conda image artifacts for Python 3.7 uses: actions/download-artifact@v3 with: @@ -294,16 +305,26 @@ jobs: name: release-image-${{ github.sha }}-3.10-conda path: /tmp/3.10/ + # Not yet available, see note at top + # - name: Download conda image artifacts for Python 3.11 + # uses: actions/download-artifact@v3 + # with: + # name: release-image-${{ github.sha }}-3.11-conda + # path: /tmp/3.11/ + - name: Load images run: | docker load --input /tmp/3.7/image.tar docker load --input /tmp/3.8/image.tar docker load --input /tmp/3.9/image.tar docker load --input /tmp/3.10/image.tar + docker load --input /tmp/3.11/image.tar docker load --input /tmp/3.7/image-conda.tar docker load --input /tmp/3.8/image-conda.tar docker load --input /tmp/3.9/image-conda.tar - docker load --input /tmp/3.10/image-conda.tar + docker load --input /tmp/3.10/image-conda. + # Not yet available, see note at top + # docker load --input /tmp/3.11/image-conda.tar - name: Login to DockerHub uses: docker/login-action@v2 diff --git a/docs/concepts/infrastructure.md b/docs/concepts/infrastructure.md index 99805c7b787f..0fa97ca57a8c 100644 --- a/docs/concepts/infrastructure.md +++ b/docs/concepts/infrastructure.md @@ -270,7 +270,7 @@ Additionally, we have "convenience" tags which are updated with each release to For example, when release `2.1.1` is published: -1. Images with the release packaged are built for each supported Python version (3.7, 3.8, 3.9, 3.10) with both standard Python and Conda. +1. Images with the release packaged are built for each supported Python version (3.7, 3.8, 3.9, 3.10, 3.11) with both standard Python and Conda. 2. These images are tagged with the full description, e.g. `prefect:2.1.1-python3.7` and `prefect:2.1.1-python3.7-conda`. 3. For users that want more specific pins, these images are also tagged with the SHA of the git commit of the release, e.g. `sha-88a7ff17a3435ec33c95c0323b8f05d7b9f3f6d2-python3.7` 4. For users that want to be on the latest `2.1.x` release, receiving patch updates, we update a tag without the patch version to this release, e.g. `prefect.2.1-python3.7`. @@ -284,14 +284,17 @@ Standard Python images are based on the official Python `slim` images, e.g. `pyt | Tag | Prefect Version | Python Version | | --------------------- | :-------------------------: | -------------: | | 2-latest | most recent v2 PyPi version | 3.10 | +| 2-python3.11 | most recent v2 PyPi version | 3.11 | | 2-python3.10 | most recent v2 PyPi version | 3.10 | | 2-python3.9 | most recent v2 PyPi version | 3.9 | | 2-python3.8 | most recent v2 PyPi version | 3.8 | | 2-python3.7 | most recent v2 PyPi version | 3.7 | +| 2.X-python3.11 | 2.X | 3.11 | | 2.X-python3.10 | 2.X | 3.10 | | 2.X-python3.9 | 2.X | 3.9 | | 2.X-python3.8 | 2.X | 3.8 | | 2.X-python3.7 | 2.X | 3.7 | +| sha-<hash>-python3.11 | <hash> | 3.11 | | sha-<hash>-python3.10 | <hash> | 3.10 | | sha-<hash>-python3.9 | <hash> | 3.9 | | sha-<hash>-python3.8 | <hash> | 3.8 | @@ -302,6 +305,8 @@ Standard Python images are based on the official Python `slim` images, e.g. `pyt Conda flavored images are based on `continuumio/miniconda3`. Prefect is installed into a conda environment named `prefect`. +Note, Conda support for Python 3.11 is not available so we cannot build an image yet. + | Tag | Prefect Version | Python Version | | --------------------------- | :-------------------------: | -------------: | | 2-latest-conda | most recent v2 PyPi version | 3.10 | diff --git a/setup.cfg b/setup.cfg index 034022734d48..cb7c945e05f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,6 +43,8 @@ filterwarnings = ignore:distutils Version classes are deprecated:DeprecationWarning # distutils is deprecated, but we are using it directly in prefect/filesystems.py ignore:The distutils package is deprecated:DeprecationWarning + # apprise<=1.1.0 has not been updated to use the new locale functions in Python 3.11 + ignore:Use setlocale:DeprecationWarning [isort] skip = __init__.py diff --git a/setup.py b/setup.py index ac6d47242159..ab802e9032fa 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries", ], ) diff --git a/src/prefect/orion/schemas/states.py b/src/prefect/orion/schemas/states.py index fa131b14bdad..4c669cb2e6c4 100644 --- a/src/prefect/orion/schemas/states.py +++ b/src/prefect/orion/schemas/states.py @@ -170,7 +170,7 @@ def __repr__(self) -> str: display = dict( message=repr(self.message), - type=self.type, + type=str(self.type.value), result=repr(result), ) @@ -186,7 +186,7 @@ def __str__(self) -> str: display_message = f"{self.message!r}" if self.message else "" display_type = ( - f", type={self.type}" + f", type={self.type.value}" if self.type.value.lower() != self.name.lower() else "" ) diff --git a/tests/test_flows.py b/tests/test_flows.py index dfad2d6300cc..1ca02621ac6c 100644 --- a/tests/test_flows.py +++ b/tests/test_flows.py @@ -1,5 +1,6 @@ import enum import inspect +import sys import time from typing import List from unittest.mock import MagicMock @@ -787,6 +788,9 @@ def test_timeout_does_not_wait_for_completion_for_sync_flows(self, tmp_path): continue until the next instruction is reached. `time.sleep` will return then the thread will be interrupted. """ + if sys.version_info[1] == 11: + pytest.xfail("The engine returns _after_ sleep finishes in Python 3.11") + canary_file = tmp_path / "canary" @flow(timeout_seconds=0.1) @@ -795,7 +799,7 @@ def my_flow(): canary_file.touch() t0 = time.perf_counter() - state = my_flow._run() + state = my_flow(return_state=True) t1 = time.perf_counter() assert state.is_failed()