Skip to content

Commit

Permalink
Merge pull request #207 remove magic of old package renaming, compati…
Browse files Browse the repository at this point in the history
…ble with arcadia protobufs
  • Loading branch information
rekby authored Mar 10, 2023
2 parents b31efcb + 8175140 commit b67866b
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 68 deletions.
Empty file removed kikimr/__init__.py
Empty file.
Empty file removed kikimr/public/__init__.py
Empty file.
6 changes: 0 additions & 6 deletions kikimr/public/api/__init__.py

This file was deleted.

Empty file removed kikimr/public/sdk/__init__.py
Empty file.
Empty file.
20 changes: 0 additions & 20 deletions kikimr/public/sdk/python/client/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions kikimr/public/sdk/python/client/frameworks/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions kikimr/public/sdk/python/iam/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions kikimr/stub.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the folder must not use for prevent issues with intersect with old packages.
34 changes: 25 additions & 9 deletions ydb/_grpc/common/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import importlib.util

import google.protobuf
from packaging.version import Version
Expand All @@ -8,15 +9,30 @@
# sdk code must always import from ydb._grpc.common
protobuf_version = Version(google.protobuf.__version__)

if protobuf_version < Version("4.0"):
from ydb._grpc.v3 import * # noqa
from ydb._grpc.v3 import protos # noqa
# for compatible with arcadia
if importlib.util.find_spec("ydb.public.api"):
from ydb.public.api.grpc import * # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v3"]
sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v3.protos"]
sys.modules["ydb._grpc.common"] = sys.modules["ydb.public.api.grpc"]

from ydb.public.api import protos

sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb.public.api.protos"]
else:
from ydb._grpc.v4 import * # noqa
from ydb._grpc.v4 import protos # noqa
# common way, outside of arcadia
if protobuf_version < Version("4.0"):
from ydb._grpc.v3 import * # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v3"]

from ydb._grpc.v3 import protos # noqa

sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v3.protos"]
else:
from ydb._grpc.v4 import * # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v4"]

from ydb._grpc.v4 import protos # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v4"]
sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v4.protos"]
sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v4.protos"]
Empty file removed ydb/public/__init__.py
Empty file.
Empty file removed ydb/public/api/__init__.py
Empty file.
8 changes: 0 additions & 8 deletions ydb/public/api/grpc/__init__.py

This file was deleted.

8 changes: 0 additions & 8 deletions ydb/public/api/protos/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions ydb/public/stub.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the folder must not use for prevent issues with intersect with old protobuf generate packages.

0 comments on commit b67866b

Please sign in to comment.