This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new c347d58448 [#4220] docs: add instruction to set up JetBrains Intellij 
IDEA for python-client (#6888)
c347d58448 is described below

commit c347d584483444157a5ab96127cd93a1a93f8e73
Author: Eric Chang <[email protected]>
AuthorDate: Mon Apr 21 08:50:43 2025 +0800

    [#4220] docs: add instruction to set up JetBrains Intellij IDEA for 
python-client (#6888)
    
    ### What changes were proposed in this pull request?
    
    Add instruction to setup Python Client environment in JetBrains Intellij
    IDEA.
    
    ### Why are the changes needed?
    
    Make new contributors feel ease to develop python clients.
    
    Fix: #4220
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes (Documentation changes).
    
    ### How was this patch tested?
    
    Clone this branch and follow the steps in
    `docs/how-to-use-python-client.md`, see if you can set up Intellij IDEA
    correctly.
---
 docs/assets/add-platform-sdk.png            | Bin 0 -> 154095 bytes
 docs/assets/configure-conda-env.png         | Bin 0 -> 110099 bytes
 docs/assets/configure-python-module-sdk.png | Bin 0 -> 274783 bytes
 docs/how-to-use-python-client.md            |  72 +++++++++++++++++++++++++++-
 4 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/docs/assets/add-platform-sdk.png b/docs/assets/add-platform-sdk.png
new file mode 100644
index 0000000000..c016205b31
Binary files /dev/null and b/docs/assets/add-platform-sdk.png differ
diff --git a/docs/assets/configure-conda-env.png 
b/docs/assets/configure-conda-env.png
new file mode 100644
index 0000000000..8997ded393
Binary files /dev/null and b/docs/assets/configure-conda-env.png differ
diff --git a/docs/assets/configure-python-module-sdk.png 
b/docs/assets/configure-python-module-sdk.png
new file mode 100644
index 0000000000..78364a0507
Binary files /dev/null and b/docs/assets/configure-python-module-sdk.png differ
diff --git a/docs/how-to-use-python-client.md b/docs/how-to-use-python-client.md
index 545bd7e04c..3932647317 100644
--- a/docs/how-to-use-python-client.md
+++ b/docs/how-to-use-python-client.md
@@ -63,7 +63,7 @@ contains the following code snippets:
 11. Drop this `Fileset.Type.EXTERNAL` type fileset and check if the fileset 
location was
     not deleted in HDFS.
 
-## How to development Apache Gravitino Python Client
+## How to develop Apache Gravitino Python Client
 
 You can ues any IDE to develop Gravitino Python Client. Directly open the 
client-python module project in the IDE.
 
@@ -84,9 +84,16 @@ You can ues any IDE to develop Gravitino Python Client. 
Directly open the client
 2. Build the Gravitino Python client module
 
     ```shell
+    # Default Python version is 3.8
     ./gradlew :clients:client-python:build
+    # If you want to build Python client with specific Python version,
+    # add `-PpythonVersion` with version number:
+    ./gradlew :clients:client-python:build -PpythonVersion=3.10
     ```
-
+   Some computer may encounter this error: `fatal error: 'cstdlib' file not 
found` while setting up Python,
+   this might because default Python version (3.8) is too
+   old, use version 3.9 or newer version instead.
+ 
 3. Run unit tests
 
     ```shell
@@ -116,6 +123,67 @@ You can ues any IDE to develop Gravitino Python Client. 
Directly open the client
     ```shell
     ./gradlew :clients:client-python:deploy
     ```
+   
+### IDE specific settings
+
+#### JetBrains IntelliJ IDEA
+
+We use Conda Environment to manage Python Environment, to configure Python
+SDK, you need to:
+
+1. Make sure you installed [Python 
Plugin](https://plugins.jetbrains.com/plugin/631-python).
+2. Make sure you followed the step to build python module in [Build and 
testing](#build-and-testing)
+3. Make sure you are at the root directory of Gravitino Git repository. 
+4. Find conda executable by executing this command
+
+   ```shell
+   find $(pwd)/.gradle/python/*/Miniforge3/bin/conda
+   
+   # example output
+   /Users/YOUR_USER_NAME/gravitino/.gradle/python/MacOSX/Miniforge3/bin/conda
+   ```
+
+5. Find Python Interpreter with this command:
+
+   ```shell
+   find $(pwd)/.gradle/python/*/Miniforge3/envs/*/bin/python
+   
+   # example output
+   
/Users/YOUR_USER_NAME/gravitino/.gradle/python/MacOSX/Miniforge3/envs/python-3.8/bin/python
+   ```
+
+6. Follow steps in [Create a conda 
environment](https://www.jetbrains.com/help/idea/configuring-python-sdk.html#gdizlj_44),
 
+and at step 5, choose [Existing conda 
environment](https://www.jetbrains.com/help/idea/configuring-python-sdk.html#existing-conda-environment)
+
+7. Fill in the output from step 4 into *Conda executable* field, step 5 into 
*Interpreter* field.
+![Configure conda_env](./assets/configure-conda-env.png)
+And you will see a new Python SDK is added, and it has several packages 
installed.
+![Add Platform SDK](./assets/add-platform-sdk.png)
+
+8. Set `clients/client-python` module sdk to the one we set in previous step.
+![Configure python module sdk](./assets/configure-python-module-sdk.png)
+
+9. Done! Now, open any python files and start developing Gravitino Python 
Client.
+
+##### Note about running integration tests of Gravitino Python client in 
IntelliJ IDEA.
+
+Since integration tests require Gravitino Java distribution, so you can not 
run tests with IntelliJ
+[Run tests button](https://www.jetbrains.com/help/idea/performing-tests.html),
+Please execute this gradle task with [Gradle 
Plugin](https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html)
+or in command line to run integration tests.
+
+```shell
+./gradlew clients:client-python:integrationTest
+```
+
+Or, you would see errors like:
+
+```shell
+...
+ERROR:tests.integration.integration_test_env:Gravitino Python client 
integration test must configure `GRAVITINO_HOME`
+
+Process finished with exit code 0
+```
 
 ## Resources
 

Reply via email to