-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[FLINK-38231][python] Standardise use of uv for PyFlink building, testing & linting #26897
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
base: master
Are you sure you want to change the base?
Conversation
@dianfu @HuangXingBo While i'm digging around the build/releasing stuff - do you know why we build/publish a wheel and an sdist for |
|
@dianfu Ah, makes sense! Thank you for the context 🙂 |
@@ -34,10 +34,10 @@ source venv/bin/activate "" | |||
# install PyFlink dependency | |||
if [[ $1 = "" ]]; then | |||
# install the latest version of pyflink | |||
pip install apache-flink | |||
uv pip install apache-flink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice we are using a very back level version of uv. Can we use the latest here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll bump it to the latest - we could also use the https://astral.sh/uv/install.sh
script to always get the latest too. Not sure whats the right approach.
What is the purpose of the change
With FLINK-37775 and FLINK-36900 we have started to use uv for managing Python testing environments and installing linting tools, as well as defining test/lint/typecheck dependencies in pyproject.toml.
However, the CI/CD scripts and developer documentation is in a bit of an inbetween state. We use uv for creating Python virtual environments for tool installation, but uv supports these natively with
uv run
disregarding the need for a custom made virtual environment, for example.This PR does the following:
uv
in our CI/CD scripts and developer documentation where possible. When it comes to lint stages such as flake8 and mypy, for example, the dependencies for those checks are managed byuv
usinguv run
. This means the install steps for those tools inlint-python.sh
can be removed, as this is managed by uv.tox-uv
extension totox
so thattox
usesuv
to create the correct python environment for testing against various python versions, rather than relying on premade virtual environments. This also means the oldinstall-command.sh
script is no longer needed.apache-flink
andapache-flink-libraries
packages were being built viapython setup.py
to instead useuv build
, taking advantage of build isolation and automatic build dependency management.apache-flink
andapache-flink-libraries
into their ownpyproject.toml
files, so they are viewed as concrete projects byuv
../apache-flink-libraries
as a uv source so that, during development, theapache-flink-libraries
package is automatically built (for example, when doinguv pip install -e .
in theflink-python
project). This sidesteps the need for building and installing theapache-flink-libraries
dependency manually from source when doing local development.build-wheels.sh
script to build the pyflink wheels usinguv build --python <python-version>
. This, coupled with the tox changes, means that thepy_env
step oflint-python.sh
(where we create venvs for supported python versions) can be removed.Brief change log
lint-python.sh
script to useuv run
for running lint, testing, typechecking and docs building steps.tox-uv
and bumped thetox
dependency so that it can create the virtualenvs that it needs to run tests as needed withuv
.uv build
,uv run
anduv pip
where possible.uv
.Verifying this change
This change is already covered by existing tests, such as PyFlink unit tests, end-to-end tests and running the
build-wheels.sh
script.Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation