Skip to content

Commit 4d974f4

Browse files
committed
chore(enhancement): rename python package to apache-polaris
- reorganize python package catalogs - union all submodules (cli, polaris) under apache_polaris module - put polaris generated context into apache_polaris/sdk - make apache_polaris as a main module
1 parent ba08463 commit 4d974f4

33 files changed

+201
-142
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ client/python/poetry.lock
3030
/pyproject.toml
3131
client/python/.openapi-generator/
3232
client/python/docs/
33-
client/python/polaris/
33+
client/python/apache_polaris/sdk/
3434
client/python/test/
3535
!client/python/test/test_cli_parsing.py
3636

File renamed without changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
File renamed without changes.

client/python/cli/api_client_builder.py renamed to client/python/apache_polaris/cli/api_client_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from functools import cached_property
2323
from typing import Optional, Dict
2424

25-
from cli.constants import (
25+
from apache_polaris.cli.constants import (
2626
CONFIG_FILE,
2727
CLIENT_PROFILE_ENV,
2828
CLIENT_ID_ENV,
@@ -33,8 +33,8 @@
3333
DEFAULT_HOSTNAME,
3434
DEFAULT_PORT
3535
)
36-
from cli.options.option_tree import Argument
37-
from polaris.management import ApiClient, Configuration
36+
from apache_polaris.cli.options.option_tree import Argument
37+
from apache_polaris.sdk.management import ApiClient, Configuration
3838

3939

4040
def _load_profiles() -> Dict[str, str]:

client/python/cli/command/__init__.py renamed to client/python/apache_polaris/cli/command/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import argparse
2020
from abc import ABC
2121

22-
from cli.constants import Commands, Arguments
23-
from cli.options.parser import Parser
24-
from polaris.management import PolarisDefaultApi
22+
from apache_polaris.cli.constants import Commands, Arguments
23+
from apache_polaris.cli.options.parser import Parser
24+
from apache_polaris.sdk.management import PolarisDefaultApi
2525

2626

2727
class Command(ABC):
@@ -44,7 +44,7 @@ def options_get(key, f=lambda x: x):
4444

4545
command = None
4646
if options.command == Commands.CATALOGS:
47-
from cli.command.catalogs import CatalogsCommand
47+
from apache_polaris.cli.command.catalogs import CatalogsCommand
4848

4949
command = CatalogsCommand(
5050
options_get(f"{Commands.CATALOGS}_subcommand"),
@@ -88,7 +88,7 @@ def options_get(key, f=lambda x: x):
8888
catalog_signing_name=options_get(Arguments.CATALOG_SIGNING_NAME)
8989
)
9090
elif options.command == Commands.PRINCIPALS:
91-
from cli.command.principals import PrincipalsCommand
91+
from apache_polaris.cli.command.principals import PrincipalsCommand
9292

9393
command = PrincipalsCommand(
9494
options_get(f"{Commands.PRINCIPALS}_subcommand"),
@@ -105,7 +105,7 @@ def options_get(key, f=lambda x: x):
105105
new_client_secret=options_get(Arguments.NEW_CLIENT_SECRET),
106106
)
107107
elif options.command == Commands.PRINCIPAL_ROLES:
108-
from cli.command.principal_roles import PrincipalRolesCommand
108+
from apache_polaris.cli.command.principal_roles import PrincipalRolesCommand
109109

110110
command = PrincipalRolesCommand(
111111
options_get(f"{Commands.PRINCIPAL_ROLES}_subcommand"),
@@ -120,7 +120,7 @@ def options_get(key, f=lambda x: x):
120120
else remove_properties,
121121
)
122122
elif options.command == Commands.CATALOG_ROLES:
123-
from cli.command.catalog_roles import CatalogRolesCommand
123+
from apache_polaris.cli.command.catalog_roles import CatalogRolesCommand
124124

125125
command = CatalogRolesCommand(
126126
options_get(f"{Commands.CATALOG_ROLES}_subcommand"),
@@ -134,7 +134,7 @@ def options_get(key, f=lambda x: x):
134134
else remove_properties,
135135
)
136136
elif options.command == Commands.PRIVILEGES:
137-
from cli.command.privileges import PrivilegesCommand
137+
from apache_polaris.cli.command.privileges import PrivilegesCommand
138138

139139
subcommand = options_get(f"{Commands.PRIVILEGES}_subcommand")
140140
command = PrivilegesCommand(
@@ -151,7 +151,7 @@ def options_get(key, f=lambda x: x):
151151
cascade=options_get(Arguments.CASCADE),
152152
)
153153
elif options.command == Commands.NAMESPACES:
154-
from cli.command.namespaces import NamespacesCommand
154+
from apache_polaris.cli.command.namespaces import NamespacesCommand
155155

156156
subcommand = options_get(f"{Commands.NAMESPACES}_subcommand")
157157
command = NamespacesCommand(
@@ -165,14 +165,14 @@ def options_get(key, f=lambda x: x):
165165
properties=properties,
166166
)
167167
elif options.command == Commands.PROFILES:
168-
from cli.command.profiles import ProfilesCommand
168+
from apache_polaris.cli.command.profiles import ProfilesCommand
169169

170170
subcommand = options_get(f"{Commands.PROFILES}_subcommand")
171171
command = ProfilesCommand(
172172
subcommand, profile_name=options_get(Arguments.PROFILE)
173173
)
174174
elif options.command == Commands.POLICIES:
175-
from cli.command.policies import PoliciesCommand
175+
from apache_polaris.cli.command.policies import PoliciesCommand
176176

177177
subcommand = options_get(f"{Commands.POLICIES}_subcommand")
178178
command = PoliciesCommand(

client/python/cli/command/catalog_roles.py renamed to client/python/apache_polaris/cli/command/catalog_roles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
from pydantic import StrictStr
2323

24-
from cli.command import Command
25-
from cli.constants import Subcommands, Arguments
26-
from cli.options.option_tree import Argument
27-
from polaris.management import (
24+
from apache_polaris.cli.command import Command
25+
from apache_polaris.cli.constants import Subcommands, Arguments
26+
from apache_polaris.cli.options.option_tree import Argument
27+
from apache_polaris.sdk.management import (
2828
PolarisDefaultApi,
2929
CreateCatalogRoleRequest,
3030
CatalogRole,

client/python/cli/command/catalogs.py renamed to client/python/apache_polaris/cli/command/catalogs.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
from dataclasses import dataclass
20-
from typing import Dict, List
2119

20+
from apache_polaris.cli.command import Command
21+
from apache_polaris.cli.constants import StorageType, CatalogType, \
22+
CatalogConnectionType, Subcommands, Arguments, AuthenticationType, \
23+
ServiceIdentityType
24+
from apache_polaris.cli.options.option_tree import Argument
25+
26+
from dataclasses import dataclass
2227
from pydantic import StrictStr, SecretStr
28+
from typing import Dict, List
2329

24-
from cli.command import Command
25-
from cli.constants import StorageType, CatalogType, CatalogConnectionType, Subcommands, Arguments, AuthenticationType, \
26-
ServiceIdentityType
27-
from cli.options.option_tree import Argument
28-
from polaris.management import PolarisDefaultApi, CreateCatalogRequest, UpdateCatalogRequest, \
29-
StorageConfigInfo, ExternalCatalog, AwsStorageConfigInfo, AzureStorageConfigInfo, GcpStorageConfigInfo, \
30-
PolarisCatalog, CatalogProperties, BearerAuthenticationParameters, ImplicitAuthenticationParameters, \
31-
OAuthClientCredentialsParameters, SigV4AuthenticationParameters, HadoopConnectionConfigInfo, \
32-
IcebergRestConnectionConfigInfo, AwsIamServiceIdentityInfo
30+
from apache_polaris.sdk.management import PolarisDefaultApi, \
31+
CreateCatalogRequest, \
32+
UpdateCatalogRequest, \
33+
StorageConfigInfo, ExternalCatalog, AwsStorageConfigInfo, \
34+
AzureStorageConfigInfo, GcpStorageConfigInfo, \
35+
PolarisCatalog, CatalogProperties, BearerAuthenticationParameters, \
36+
ImplicitAuthenticationParameters, \
37+
OAuthClientCredentialsParameters, SigV4AuthenticationParameters, \
38+
HadoopConnectionConfigInfo, \
39+
IcebergRestConnectionConfigInfo, AwsIamServiceIdentityInfo
3340

3441

3542
@dataclass

client/python/cli/command/namespaces.py renamed to client/python/apache_polaris/cli/command/namespaces.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
#
1919
import json
2020
from dataclasses import dataclass
21-
from typing import Dict, Optional, List
22-
2321
from pydantic import StrictStr
22+
from typing import Dict, Optional, List
2423

25-
from cli.command import Command
26-
from cli.command.utils import get_catalog_api_client
27-
from cli.constants import Subcommands, Arguments, UNIT_SEPARATOR
28-
from cli.options.option_tree import Argument
29-
from polaris.catalog import IcebergCatalogAPI, CreateNamespaceRequest
30-
from polaris.management import PolarisDefaultApi
24+
from apache_polaris.cli.command import Command
25+
from apache_polaris.cli.command.utils import get_catalog_api_client
26+
from apache_polaris.cli.constants import Subcommands, Arguments, UNIT_SEPARATOR
27+
from apache_polaris.cli.options.option_tree import Argument
28+
from apache_polaris.sdk.catalog import IcebergCatalogAPI, CreateNamespaceRequest
29+
from apache_polaris.sdk.management import PolarisDefaultApi
3130

3231

3332
@dataclass

client/python/cli/command/policies.py renamed to client/python/apache_polaris/cli/command/policies.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,29 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
import os
19+
2020
import json
21+
22+
import os
2123
from dataclasses import dataclass
2224
from typing import Optional, Dict
23-
from cli.command import Command
24-
from cli.command.utils import get_catalog_api_client
25-
from cli.constants import Subcommands, Arguments, UNIT_SEPARATOR
26-
from cli.options.option_tree import Argument
27-
from polaris.management import PolarisDefaultApi
28-
from polaris.catalog.api.policy_api import PolicyAPI
29-
from polaris.catalog.models.create_policy_request import CreatePolicyRequest
30-
from polaris.catalog.models.update_policy_request import UpdatePolicyRequest
31-
from polaris.catalog.models.policy_attachment_target import PolicyAttachmentTarget
32-
from polaris.catalog.models.attach_policy_request import AttachPolicyRequest
33-
from polaris.catalog.models.detach_policy_request import DetachPolicyRequest
3425

26+
from apache_polaris.cli.command import Command
27+
from apache_polaris.cli.command.utils import get_catalog_api_client
28+
from apache_polaris.cli.constants import Subcommands, Arguments, UNIT_SEPARATOR
29+
from apache_polaris.cli.options.option_tree import Argument
30+
from apache_polaris.sdk.catalog.api.policy_api import PolicyAPI
31+
from apache_polaris.sdk.catalog.models.attach_policy_request import \
32+
AttachPolicyRequest
33+
from apache_polaris.sdk.catalog.models.create_policy_request import \
34+
CreatePolicyRequest
35+
from apache_polaris.sdk.catalog.models.detach_policy_request import \
36+
DetachPolicyRequest
37+
from apache_polaris.sdk.catalog.models.policy_attachment_target import \
38+
PolicyAttachmentTarget
39+
from apache_polaris.sdk.catalog.models.update_policy_request import \
40+
UpdatePolicyRequest
41+
from apache_polaris.sdk.management import PolarisDefaultApi
3542

3643

3744
@dataclass

0 commit comments

Comments
 (0)