Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable python 3.12 #2005

Merged
merged 33 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
12267db
Enable python 3.12
eapolinario Nov 28, 2023
f004813
Merge remote-tracking branch 'origin' into enable-python-3.12
eapolinario Nov 30, 2023
12bdfb6
Relax the constraints on tensorflow
eapolinario Nov 30, 2023
5ceac5f
wip - split tensorflow tests
eapolinario Dec 1, 2023
0195896
Merge remote-tracking branch 'origin' into enable-python-3.12
eapolinario Dec 19, 2023
57f2435
Run on python 3.12
eapolinario Dec 19, 2023
8b05b5c
Split tensorflow unit tests in their own tests
eapolinario Dec 19, 2023
9e5484d
Fix typo in dev-requirements.in
eapolinario Dec 19, 2023
29585e3
Run extra unit tests in separate step
eapolinario Dec 19, 2023
212fe11
Remove windows restriction
eapolinario Dec 19, 2023
e599be3
Fix unit_test_extras make target
eapolinario Dec 19, 2023
e7ff49a
Fix typo in makefile and version restriction in dev-requirements.in
eapolinario Dec 19, 2023
d570592
Add support for 3.12 in default_images.py
eapolinario Dec 19, 2023
896dbf1
Modify regex in dataclass tests
eapolinario Dec 19, 2023
4ecbd0d
Rename step in pythonbuild gh workflow
eapolinario Dec 19, 2023
7b6503b
Enable 3.12 in serialization tests
eapolinario Dec 19, 2023
6d0fb12
Read python versions from env var
eapolinario Dec 19, 2023
c1d0dc9
Revert "Read python versions from env var"
eapolinario Dec 19, 2023
2108a8f
Run integration tests on 3.12
eapolinario Dec 19, 2023
ead755c
Use bookworm as base image
eapolinario Dec 19, 2023
603cda5
Merge remote-tracking branch 'origin' into enable-python-3.12
eapolinario Dec 20, 2023
00b04f2
Restrict ydata-profiling
eapolinario Dec 20, 2023
182211c
Install latest flytekit
eapolinario Dec 20, 2023
a81235b
Mount .git in dev image and output version
eapolinario Dec 20, 2023
a4522a4
Cat dynamic version in integration test gh workflow
eapolinario Dec 20, 2023
0bf5d62
Use solution described in https://github.com/pypa/setuptools_scm/issu…
eapolinario Dec 20, 2023
e695bf9
Remove investigation aids
eapolinario Dec 21, 2023
218e85c
Install pandas in deck plugin
eapolinario Dec 21, 2023
5fb314e
Revert bump of flytekit version in pod plugin
eapolinario Dec 21, 2023
3a859f1
Combine installation of flytekit and plugins in dev image
eapolinario Dec 21, 2023
83fe66a
Test setting fetch-depth: 0
eapolinario Dec 21, 2023
dfd1478
Use with stanza
eapolinario Dec 21, 2023
ce22890
Comment need for fetch-depth: 0
eapolinario Dec 21, 2023
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
18 changes: 15 additions & 3 deletions .github/workflows/pythonbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -39,6 +39,14 @@ jobs:
make setup
pip uninstall -y pandas
pip freeze
- name: Run extras unit tests with coverage
# Skip this step if running on python 3.12 due to https://github.com/tensorflow/tensorflow/issues/62003
# and https://github.com/pytorch/pytorch/issues/110436
if: ${{ matrix.python-version != '3.12' }}
env:
PYTEST_OPTS: -n2
run: |
make unit_test_extras_codecov
- name: Test with coverage
env:
PYTEST_OPTS: -n2
Expand Down Expand Up @@ -93,7 +101,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -128,10 +136,14 @@ jobs:
os: [ubuntu-latest]
# python 3.11 has intermittent issues with the docker build + push step
# https://github.com/flyteorg/flytekit/actions/runs/5800978835/job/15724237979?pr=1579
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.11", "3.12"]
steps:
- uses: insightsengineering/disk-space-reclaimer@v1
# As described in https://github.com/pypa/setuptools_scm/issues/414, SCM needs git history
# and tags to work.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim-buster
FROM python:${PYTHON_VERSION}-slim-bookworm

MAINTAINER Flyte Team <users@flyte.org>
LABEL org.opencontainers.image.source=https://github.com/flyteorg/flytekit
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.agent
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim-buster
FROM python:3.9-slim-bookworm

MAINTAINER Flyte Team <users@flyte.org>
LABEL org.opencontainers.image.source=https://github.com/flyteorg/flytekit
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# $ pyflyte run --image localhost:30000/flytekittest:someversion

ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim-buster
FROM python:${PYTHON_VERSION}-slim-bookworm

MAINTAINER Flyte Team <users@flyte.org>
LABEL org.opencontainers.image.source https://github.com/flyteorg/flytekit
Expand All @@ -28,10 +28,10 @@ COPY . /flytekit
# 4. Create a non-root user 'flytekit' and set appropriate permissions for directories.
RUN apt-get update && apt-get install build-essential vim libmagic1 git -y \
&& pip install --no-cache-dir -e /flytekit \
&& pip install --no-cache-dir -e /flytekit/plugins/flytekit-k8s-pod \
&& pip install --no-cache-dir -e /flytekit/plugins/flytekit-deck-standard \
&& pip install --no-cache-dir -e /flytekit/plugins/flytekit-flyin \
&& pip install --no-cache-dir scikit-learn \
-e /flytekit/plugins/flytekit-k8s-pod \
-e /flytekit/plugins/flytekit-deck-standard \
-e /flytekit/plugins/flytekit-flyin \
scikit-learn \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ \
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,19 @@ test: lint unit_test
unit_test_codecov:
$(MAKE) CODECOV_OPTS="--cov=./ --cov-report=xml --cov-append" unit_test

.PHONY: unit_test_extras_codecov
unit_test_extras_codecov:
$(MAKE) CODECOV_OPTS="--cov=./ --cov-report=xml --cov-append" unit_test_extras

.PHONY: unit_test
unit_test:
# Skip tensorflow tests and run them with the necessary env var set so that a working (albeit slower)
# Skip all extra tests and run them with the necessary env var set so that a working (albeit slower)
# library is used to serialize/deserialize protobufs is used.
$(PYTEST) -m "not sandbox_test" tests/flytekit/unit/ --ignore=tests/flytekit/unit/extras/tensorflow --ignore=tests/flytekit/unit/models ${CODECOV_OPTS} && \
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(PYTEST) tests/flytekit/unit/extras/tensorflow ${CODECOV_OPTS}
$(PYTEST) -m "not sandbox_test" tests/flytekit/unit/ --ignore=tests/flytekit/unit/extras/ --ignore=tests/flytekit/unit/models ${CODECOV_OPTS}

.PHONY: unit_test_extras
unit_test_extras:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(PYTEST) tests/flytekit/unit/extras ${CODECOV_OPTS}

.PHONY: test_serialization_codecov
test_serialization_codecov:
Expand Down
10 changes: 4 additions & 6 deletions dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ IPython
keyrings.alt
setuptools_scm

# Only install tensorflow if not running on an arm Mac.
tensorflow==2.8.1; python_version<'3.11' and (platform_machine!='arm64' or platform_system!='Darwin')
# Tensorflow release candidate supports python 3.11
tensorflow==2.13.0; python_version>='3.11' and (platform_machine!='arm64' or platform_system!='Darwin')

# Tensorflow is not available for python 3.12 yet: https://github.com/tensorflow/tensorflow/issues/62003
tensorflow; python_version<'3.12'
# Newer versions of torch bring in nvidia dependencies that are not present in windows, so
# we put this constraint while we do not have per-environment requirements files
torch<=1.12.1; python_version<'3.11'
# pytorch 2 supports python 3.11
torch<=2.0.0; python_version>='3.11' or platform_system!='Windows'
# pytorch 2 does not support 3.12 yet: https://github.com/pytorch/pytorch/issues/110436
torch; python_version<'3.12'

# TODO: Currently, the python-magic library causes build errors on Windows due to its dependency on DLLs for libmagic.
# We have temporarily disabled this feature on Windows and are using python-magic for Mac OS and Linux instead.
Expand Down
2 changes: 2 additions & 0 deletions flytekit/configuration/default_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class PythonVersion(enum.Enum):
PYTHON_3_9 = (3, 9)
PYTHON_3_10 = (3, 10)
PYTHON_3_11 = (3, 11)
PYTHON_3_12 = (3, 12)


class DefaultImages(object):
Expand All @@ -20,6 +21,7 @@ class DefaultImages(object):
PythonVersion.PYTHON_3_9: "cr.flyte.org/flyteorg/flytekit:py3.9-",
PythonVersion.PYTHON_3_10: "cr.flyte.org/flyteorg/flytekit:py3.10-",
PythonVersion.PYTHON_3_11: "cr.flyte.org/flyteorg/flytekit:py3.11-",
PythonVersion.PYTHON_3_12: "cr.flyte.org/flyteorg/flytekit:py3.12-",
}

@classmethod
Expand Down
4 changes: 3 additions & 1 deletion plugins/flytekit-deck-standard/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"flytekit",
"markdown",
"plotly",
"ydata-profiling",
# ydata-profiling is not compatible with python 3.12 yet: https://github.com/ydataai/ydata-profiling/issues/1510
"ydata-profiling; python_version<'3.12'",
"pandas",
"ipywidgets",
"pygments",
]
Expand Down
2 changes: 1 addition & 1 deletion plugins/flytekit-flyin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim-buster
FROM python:3.10-slim-bookworm
MAINTAINER Flyte Team <users@flyte.org>
LABEL org.opencontainers.image.source https://github.com/flyteorg/flytekit
WORKDIR /root
Expand Down
2 changes: 1 addition & 1 deletion plugins/flytekit-sqlalchemy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim-buster
FROM python:${PYTHON_VERSION}-slim-bookworm

WORKDIR /root
ENV LANG C.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = [{ name = "Flyte Contributors", email = "admin@flyte.org" }]
description = "Flyte SDK for Python"
license = { text = "Apache-2.0" }
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.8,<3.12"
requires-python = ">=3.8,<3.13"
dependencies = [
# Please maintain an alphabetical order in the following list
"adlfs",
Expand Down
4 changes: 2 additions & 2 deletions tests/flytekit/unit/core/test_type_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ class Bar(DataClassJsonMixin):

pv = Bar(x=3)
with pytest.raises(
TypeTransformerFailedError, match="Type of Val '<class 'int'>' is not an instance of <class 'types.ArgsSchema'>"
TypeTransformerFailedError, match="Type of Val '<class 'int'>' is not an instance of <class '.*.ArgsSchema'>"
):
DataclassTransformer().assert_type(gt, pv)

Expand Down Expand Up @@ -1438,7 +1438,7 @@ class Bar(DataClassJSONMixin):
pv = Bar(x=3)
with pytest.raises(
TypeTransformerFailedError,
match="Type of Val '<class 'int'>' is not an instance of <class 'types.ArgsAssert'>",
match="Type of Val '<class 'int'>' is not an instance of <class '.*.ArgsAssert'>",
):
DataclassTransformer().assert_type(gt, pv)

Expand Down