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

[#2230] feat(client-python): Add doc and support publishing Gravitino Python client to Pypi #2932

Merged
merged 13 commits into from
May 14, 2024

Conversation

SophieTech88
Copy link
Contributor

@SophieTech88 SophieTech88 commented Apr 14, 2024

What changes were proposed in this pull request?

We published the first version of python-client package of Gravitino to Pypi.

  1. Add how to use Python Client document
  2. add some tools to requirements.txt
  3. ./gradlew :clients:client-python:distribution
  4. ./gradlew :clients:client-python:deploy

Why are the changes needed?

We need the python client package for user to use Gravitino in Python project.

#2230

Does this PR introduce any user-facing change?

Users can use pip install gravitino to install the Gravitino python-client package directly.

How was this patch tested?

CI Passed

@qqqttt123 qqqttt123 changed the title [#2230]Publish the first version of Gravitino Pyhton client to Pypi [#2230] build: Publish the first version of Gravitino Pyhton client to Pypi Apr 14, 2024
@xunliu
Copy link
Member

xunliu commented Apr 22, 2024

I will improve this PR.

@SophieTech88
Copy link
Contributor Author

I will improve this PR.

Many thanks.

@xunliu xunliu added the 0.5.1 Release v0.5.1 label May 6, 2024
@xunliu xunliu added this to the Gravitino June Release milestone May 6, 2024
@jerryshao jerryshao added branch-0.5 and removed 0.5.1 Release v0.5.1 labels May 11, 2024
@xunliu xunliu force-pushed the sophies-2230 branch 2 times, most recently from bc039e3 to 11b01c1 Compare May 12, 2024 14:18
@xunliu xunliu changed the title [#2230] build: Publish the first version of Gravitino Pyhton client to Pypi [#2230] feat(PyClient): Publish Gravitino Python client to Pypi May 12, 2024
@xunliu
Copy link
Member

xunliu commented May 12, 2024

hi @SophieTech88 I help you improvement this PR,
@SophieTech88 @coolderli @noidname01 @zhaoyongjie Please help me review this PR, Thanks!

5. Distribute the Gravitino Python client module

```shell
./gradlew :clients:client-python:distribute
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no distribute task in build.gradle.kts, only distribution task.

Copy link
Member

Choose a reason for hiding this comment

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

OK, I fixed it.

@@ -8,7 +8,7 @@ This software is licensed under the Apache License version 2."

## Playground introduction

The playground is a complete Gravitino Docker runtime environment with `Hive`, `HDFS`, `Trino`, `MySQL`, `PostgreSQL`, and a `Gravitino` server.
The playground is a complete Gravitino Docker runtime environment with `Hive`, `HDFS`, `Trino`, `MySQL`, `PostgreSQL`, `Jupter`, and a `Gravitino` server.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's Jupyter?

Copy link
Member

Choose a reason for hiding this comment

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

OK, I fixed it.

```

### Experiencing Gravitino Fileset with Jupyter
We proved a Fileset playground environment to help you quickly understand how to use Gravitino Python client to manage HDFS in Gravitino service.
Copy link
Collaborator

Choose a reason for hiding this comment

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

proved -> provided?

Copy link
Member

Choose a reason for hiding this comment

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

DONE

3. Install Gravitino Python client
4. Initialize Gravitino admin client and create a Gravitino metalake
5. Initialize Gravitino client and list metalakes
6. Create a Gravitino `Catalog` and special `type` is `Catalog.Type.FILESET` and `proved` is [hadoop](https://datastrato.ai/docs/latest/hadoop-catalog)
Copy link
Collaborator

Choose a reason for hiding this comment

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

proved -> provider

Copy link
Member

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me rewrite this doc.

@@ -200,15 +200,14 @@ def format_fileset_request_path(namespace: Namespace) -> str:
def to_fileset_update_request(change: FilesetChange):
if isinstance(change, FilesetChange.RenameFileset):
return FilesetUpdateRequest.RenameFilesetRequest(change.new_name())
elif isinstance(change, FilesetChange.UpdateFilesetComment):
if isinstance(change, FilesetChange.UpdateFilesetComment):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we change the elif to if? Does that mean we have to continue the remaining if judgment even though the first if is matched?

Copy link
Contributor

Choose a reason for hiding this comment

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

logically it is the same because of the return, right? Let me check if it is the code style of python.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, actually it's no-else-return in Pylint, it's not necessary to use elif in this case.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it.

setup(
name="gravitino",
description="Python lib/client for Gravitino",
version="0.5.0",
long_description=open("README.md").read(),
version="0.5.0.dev12",
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we define this version 0.5.0.dev12?

Copy link
Member

Choose a reason for hiding this comment

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

Here covers all versioning Python packages.
https://packaging.python.org/en/latest/discussions/versioning/

The version number need to be changed each commit Pypi.org.

packages=find_packages(include=["gravitino", ".*"]),
packages=find_packages(exclude=["tests*"]),
classifiers=[
'Development Status :: 3 - Alpha',
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the meaning of 3 - Alpha, does it have special purpose?

Copy link
Member

Choose a reason for hiding this comment

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

This is Pypi.org's development status classify, https://pypi.org/search/?c=Development+Status+%3A%3A+3+-+Alpha

First of all, You must have a Gravitino Service, You can refer document of [How to install Gravitino](https://datastrato.ai/docs/latest/how-to-install)
to build Gravitino service from source code and install it in your local.

### Gravitino Python client API
Copy link
Contributor

Choose a reason for hiding this comment

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

You'd better add a chapter/paragraph here about how to install or use python client, like pip install or something else.

Copy link
Member

Choose a reason for hiding this comment

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

Done

@jerryshao
Copy link
Contributor

@xunliu please review again, I did some changes in doc.

@xunliu
Copy link
Member

xunliu commented May 14, 2024

@xunliu please review again, I did some changes in doc.

The doc context very good!

But If use relative path in the doc, We need convert url to absolute path,

  1. Because when deploy Python client to Pypi.org, Gradle script will copy how-to-use-python-client.md to clients-client-python/README.md and Pypi.org will use this file generation home web page.
  2. otherwise Pypi.org don't support upload image file, so we must link external image.

So I add a commit to support convert url.

@jerryshao Please help me review this PR, Thanks.

@jerryshao jerryshao changed the title [#2230] feat(PyClient): Publish Gravitino Python client to Pypi [#2230] feat(client-python): Add doc and support publishing Gravitino Python client to Pypi May 14, 2024
@jerryshao
Copy link
Contributor

Thanks @SophieTech88 @xunliu for your contributions. I'm going to merge this.

@jerryshao jerryshao merged commit 12c32c7 into apache:main May 14, 2024
9 checks passed
github-actions bot pushed a commit that referenced this pull request May 14, 2024
… Python client to Pypi (#2932)

### What changes were proposed in this pull request?
We published the first version of python-client package of Gravitino to
Pypi.
1. Add how to use Python Client document
2. add some tools to requirements.txt
3. `./gradlew :clients:client-python:distribution`
4. `./gradlew :clients:client-python:deploy`

### Why are the changes needed?
We need the python client package for user to use Gravitino in Python
project.

#2230

### Does this PR introduce _any_ user-facing change?
Users can use `pip install gravitino` to install the Gravitino
python-client package directly.

### How was this patch tested?
CI Passed

---------

Co-authored-by: xunliu <xun@datastrato.com>
Co-authored-by: Jerry Shao <jerryshao@datastrato.com>
diqiu50 pushed a commit to diqiu50/gravitino that referenced this pull request Jun 13, 2024
…vitino Python client to Pypi (apache#2932)

### What changes were proposed in this pull request?
We published the first version of python-client package of Gravitino to
Pypi.
1. Add how to use Python Client document
2. add some tools to requirements.txt
3. `./gradlew :clients:client-python:distribution`
4. `./gradlew :clients:client-python:deploy`

### Why are the changes needed?
We need the python client package for user to use Gravitino in Python
project.

apache#2230

### Does this PR introduce _any_ user-facing change?
Users can use `pip install gravitino` to install the Gravitino
python-client package directly.

### How was this patch tested?
CI Passed

---------

Co-authored-by: xunliu <xun@datastrato.com>
Co-authored-by: Jerry Shao <jerryshao@datastrato.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants