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

[#2518] feat(PyClient): Integrate pytest with Gradle to run python test with CICD #2753

Merged
merged 10 commits into from
Apr 3, 2024

Conversation

xunliu
Copy link
Member

@xunliu xunliu commented Apr 1, 2024

What changes were proposed in this pull request?

  1. Use Gradle python plugin to manage python module
  2. Automatic download conda and create python env in gravitino/.gradle/python directory
  3. Use multiple python version 3.8, 3.9, 3.10,and 3.11 test ITs in Github Action
  4. Support gradlew clean & gradlew build & gradlew :client:client-python:test -PpythonVersion=3.8

Why are the changes needed?

Use Gradle manager and development Python client module.

Fix: #2518

Does this PR introduce any user-facing change?

  1. Use pythonVersion Gradle parameter setting Python version to compile and test Python client, gradlew :client:client-python:test -PpythonVersion=3.8
  2. Use skipPythonITs Gradle parameter to control if skip Python test cases.

How was this patch tested?

CI Passed.

@xunliu xunliu requested a review from shaofengshi April 1, 2024 08:56
@xunliu
Copy link
Member Author

xunliu commented Apr 1, 2024

hi @shaofengshi @zhaoyongjie @coolderli Please help me review this PR, Thanks!

@shaofengshi
Copy link
Contributor

Hi Xun, I have two comments:

  1. is the "python-gradle-miniforge-plugin" a formal gradle plugin? The project seems not under maintained, the last commit is 2 years ago;
  2. conda seems more heavy than venv; I'm not sure whether it can switch to venv;

For other parts, it looks good to me

@xunliu
Copy link
Member Author

xunliu commented Apr 1, 2024

hi @shaofengshi

  1. is the "python-gradle-miniforge-plugin" a formal gradle plugin? The project seems not under maintained, the last commit is 2 years ago;

Yes, Because Python Gradle plugin is very few, I didn't found better than to python-gradle-miniforge-plugin.
I think python-gradle-miniforge-plugin fulfill our needs.

  1. conda seems more heavy than venv; I'm not sure whether it can switch to venv;

I didn't found a Python Gradle plugin would to support venv.

I think we could use it first.

@shaofengshi
Copy link
Contributor

hi @shaofengshi

  1. is the "python-gradle-miniforge-plugin" a formal gradle plugin? The project seems not under maintained, the last commit is 2 years ago;

Yes, Because Python Gradle plugin is very few, I didn't found better than to python-gradle-miniforge-plugin. I think python-gradle-miniforge-plugin fulfill our needs.

  1. conda seems more heavy than venv; I'm not sure whether it can switch to venv;

I didn't found a Python Gradle plugin would to support venv.

I think we could use it first.

OK, we can go with this first, and refine later.

shaofengshi
shaofengshi previously approved these changes Apr 1, 2024
@jerryshao jerryshao removed this from the Gravitino 0.5.0 milestone Apr 1, 2024
}

compileJava {
dependsOn(pipInstall)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the compile and spotless depend on pip install? Python doesn't need to compile and can't verify the correctness of the program. If the user only updates the Java code, they also need to download the dependencies of the Python module. How about just making the test depend on pip install?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Currently use Gradle to comple Python module have this limit (need add compileJava).
I Create an issue #2770 to track this probleam.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @coolderli I fixed this problem in this PR. :-)

@jerryshao
Copy link
Contributor

Is this python environment removable, where is it installed?

@xunliu
Copy link
Member Author

xunliu commented Apr 2, 2024

Is this python environment removable, where is it installed?这个python环境是可移动的,安装在哪里?

Automatic download conda and create python env in gravitino/.gradle/python directory

@xunliu
Copy link
Member Author

xunliu commented Apr 2, 2024

@shaofengshi @zhaoyongjie @coolderli Please help me review this PR, Thanks.

@@ -9,7 +9,7 @@
setup(
name="gravitino",
description="project description TBD",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put some description, like "Python lib/client for Gravitino"

- api/**
- bin/**
- catalogs/**
- clients/client-java/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there too many file directories involved here? If the clients/client-java, clients/client-java-runtime changes, I think it doesn't need to run the python-integration-test CICD. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion.


- name: Package Gravitino
run: |
./gradlew build -x test -PjdkVersion=${{ matrix.java-version }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just build the clients:client-python here? The whole build step has already been covered by build.yml.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. I modified PR.

@coolderli
Copy link
Contributor

@xunliu Hi, I left two comments. Overall, LGTM. Thanks.

coolderli and others added 10 commits April 3, 2024 22:06
…e#2684)

### What changes were proposed in this pull request?

 - use Gradle to manage Python build.
 - add Github CI
 - `./gradlew clean clients:client-python:test`

### Why are the changes needed?

Fix: apache#2518 

### Does this PR introduce _any_ user-facing change?

- no

### How was this patch tested?

- `./gradlew clean clients:client-python:test`
@shaofengshi
Copy link
Contributor

LGTM

@xunliu xunliu merged commit f7f12d8 into apache:main Apr 3, 2024
27 checks passed
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.

[Subtask] integrate pytest with gradle to run python test with CICD
4 participants