Skip to content

[FLINK-34195][python] Use python3 as the default Python executable#28450

Draft
lh0156 wants to merge 1 commit into
apache:masterfrom
lh0156:FLINK-34195-python3-env
Draft

[FLINK-34195][python] Use python3 as the default Python executable#28450
lh0156 wants to merge 1 commit into
apache:masterfrom
lh0156:FLINK-34195-python3-env

Conversation

@lh0156

@lh0156 lh0156 commented Jun 15, 2026

Copy link
Copy Markdown

What is the purpose of the change

This pull request updates PyFlink's default Python executable from python to python3 on non-Windows environments.

PyFlink requires Python 3.9+, but python may resolve to Python 2 or may not exist on systems where Python 3 is installed as python3. Using python3 as the default aligns the runtime defaults, shell script defaults, and documentation with the supported Python versions.

Brief change log

  • Changed python.executable and python.client.executable defaults to python3.
  • Changed the default Python executable used by PythonEnvUtils on non-Windows environments to python3.
  • Updated PyFlink shell and UDF runner script defaults to use python3.
  • Updated PyFlink installation and configuration docs to prefer python3.
  • Added regression coverage for the default option values and PythonEnvUtils default environment.

Verifying this change

This change added tests and can be verified as follows:

  • Added assertions in PythonOptionsTest for the default python.executable and python.client.executable values.
  • Updated PythonEnvUtilsTest to expect python3 as the non-Windows default executable while keeping the Windows default as python.exe.
  • Ran bash -n flink-python/bin/pyflink-shell.sh.
  • Ran bash -n flink-python/pyflink/bin/pyflink-udf-runner.sh.
  • Ran git diff --check.
  • Searched the touched PyFlink code, scripts, and docs to ensure stale python defaults and Python 3.8 wording were not left behind.

I also attempted to run:

  • ./mvnw -pl flink-python -am -Dtest=PythonEnvUtilsTest,PythonOptionsTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -DskipITs -Dfast test

The local reactor build had to be stopped before reaching flink-python because the machine had 249 MiB of free disk space remaining while Maven was still compiling upstream reactor dependencies.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (Codex)

Generated-by: Codex (GPT-5)

@flinkbot

flinkbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants