Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/python-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ jobs:
distribution: 'temurin'
java-version: '21'

- name: Run regeneratePythonClient
run: ./gradlew regeneratePythonClient

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ jobs:
- name: Fix permissions
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*

- name: Run regeneratePythonClient
run: ./gradlew regeneratePythonClient

- name: Image build
run: |
./gradlew \
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/spark_client_regtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ jobs:
- name: Fix permissions
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*

- name: Run regeneratePythonClient
run: ./gradlew regeneratePythonClient

- name: Project build without testing
run: ./gradlew assemble

Expand Down
91 changes: 91 additions & 0 deletions client/python/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import os.path
import subprocess
from pathlib import Path

# Paths
PROJECT_ROOT = Path(__file__).parent
SPEC_DIR = os.path.join(PROJECT_ROOT, "spec")
POLARIS_MANAGEMENT_SPEC = os.path.join(SPEC_DIR, "polaris-management-service.yml")
ICEBERG_CATALOG_SPEC = os.path.join(SPEC_DIR, "iceberg-rest-catalog-open-api.yaml")
POLARIS_CATALOG_SPEC = os.path.join(SPEC_DIR, "polaris-catalog-service.yaml")
OPEN_API_GENERATOR_IGNORE = os.path.join(PROJECT_ROOT, ".openapi-generator-ignore")

# Open API Generator Configs
PACKAGE_NAME_POLARIS_MANAGEMENT = "--additional-properties=packageName=polaris.management"
PACKAGE_NAME_POLARIS_CATALOG = "--additional-properties=packageName=polaris.catalog"
PYTHON_VERSION = "--additional-properties=pythonVersion=3.9"

def generate_polaris_management_client() -> None:
subprocess.check_call([
"openapi-generator-cli", "generate",
"-i", POLARIS_MANAGEMENT_SPEC,
"-g", "python",
"-o", PROJECT_ROOT,
PACKAGE_NAME_POLARIS_MANAGEMENT,
"--additional-properties=apiNamePrefix=polaris",
PYTHON_VERSION,
"--ignore-file-override", OPEN_API_GENERATOR_IGNORE
],
stdout=subprocess.DEVNULL)

def generate_polaris_catalog_client() -> None:
subprocess.check_call([
"openapi-generator-cli", "generate",
"-i", POLARIS_CATALOG_SPEC,
"-g", "python",
"-o", PROJECT_ROOT,
PACKAGE_NAME_POLARIS_CATALOG,
"--additional-properties=apiNameSuffix=",
PYTHON_VERSION,
"--skip-validate-spec",
"--ignore-file-override", OPEN_API_GENERATOR_IGNORE
],
stdout=subprocess.DEVNULL)

def generate_iceberg_catalog_client() -> None:
subprocess.check_call([
"openapi-generator-cli", "generate",
"-i", ICEBERG_CATALOG_SPEC,
"-g", "python",
"-o", PROJECT_ROOT,
PACKAGE_NAME_POLARIS_CATALOG,
"--additional-properties=apiNameSuffix=",
"--additional-properties=apiNamePrefix=Iceberg",
PYTHON_VERSION,
"--skip-validate-spec",
"--ignore-file-override", OPEN_API_GENERATOR_IGNORE
],
stdout=subprocess.DEVNULL)

def build() -> None:
generate_polaris_management_client()
generate_polaris_catalog_client()
generate_iceberg_catalog_client()

if __name__ == "__main__":
build()
Empty file removed client/python/polaris/.keep
Empty file.
6 changes: 5 additions & 1 deletion client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ pyiceberg = "==0.9.1"
pre-commit = "==4.2.0"

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
requires = ["poetry-core>=2.0.0,<3.0.0", "openapi-generator-cli==7.11.0.post0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.build]
generate-setup-file = false
script = "build.py"
1 change: 1 addition & 0 deletions client/python/spec
1 change: 0 additions & 1 deletion regtests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function logred() {

REGTEST_HOME=$(dirname $(realpath $0))

cd "${SCRIPT_DIR}/.." && ./gradlew regeneratePythonClient
cd ${REGTEST_HOME}

./setup.sh
Expand Down
Loading