Skip to content

Commit 0573edb

Browse files
fix: remove absl dependency (#94)
1 parent 5da7aa4 commit 0573edb

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

google/cloud/pubsublite/internal/wire/assigner_impl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import asyncio
1616
from typing import Optional, Set
1717

18-
from absl import logging
18+
import logging
1919

2020
from google.cloud.pubsublite.internal.wait_ignore_cancelled import wait_ignore_errors
2121
from google.cloud.pubsublite.internal.wire.assigner import Assigner
@@ -36,6 +36,8 @@
3636
PartitionAssignmentAck,
3737
)
3838

39+
_LOGGER = logging.getLogger(__name__)
40+
3941
# Maximum bytes per batch at 3.5 MiB to avoid GRPC limit of 4 MiB
4042
_MAX_BYTES = int(3.5 * 1024 * 1024)
4143

@@ -120,7 +122,7 @@ async def get_assignment(self) -> Set[Partition]:
120122
self._outstanding_assignment = False
121123
except GoogleAPICallError as e:
122124
# If there is a failure to ack, keep going. The stream likely restarted.
123-
logging.debug(
125+
_LOGGER.debug(
124126
f"Assignment ack attempt failed due to stream failure: {e}"
125127
)
126128
return await self._connection.await_unless_failed(self._new_assignment.get())

google/cloud/pubsublite/internal/wire/committer_impl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import asyncio
1616
from typing import Optional, List, Iterable
1717

18-
from absl import logging
18+
import logging
1919

2020
from google.cloud.pubsublite.internal.wait_ignore_cancelled import wait_ignore_errors
2121
from google.cloud.pubsublite.internal.wire.committer import Committer
@@ -41,6 +41,9 @@
4141
from google.cloud.pubsublite.internal.wire.work_item import WorkItem
4242

4343

44+
_LOGGER = logging.getLogger(__name__)
45+
46+
4447
class CommitterImpl(
4548
Committer,
4649
ConnectionReinitializer[
@@ -149,7 +152,7 @@ async def _flush(self):
149152
try:
150153
await self._connection.write(req)
151154
except GoogleAPICallError as e:
152-
logging.debug(f"Failed commit on stream: {e}")
155+
_LOGGER.debug(f"Failed commit on stream: {e}")
153156
self._fail_if_retrying_failed()
154157

155158
async def commit(self, cursor: Cursor) -> None:

google/cloud/pubsublite/internal/wire/pubsub_context.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
from base64 import b64encode
1616
from typing import Mapping, Optional, NamedTuple
1717

18-
from absl import logging
18+
import logging
1919
import pkg_resources
2020
from google.protobuf import struct_pb2
2121

2222

23+
_LOGGER = logging.getLogger(__name__)
24+
25+
2326
class _Semver(NamedTuple):
2427
major: int
2528
minor: int
@@ -29,7 +32,7 @@ def _version() -> _Semver:
2932
version = pkg_resources.get_distribution("google-cloud-pubsublite").version
3033
splits = version.split(".")
3134
if len(splits) != 3:
32-
logging.info(f"Failed to extract semver from {version}.")
35+
_LOGGER.info(f"Failed to extract semver from {version}.")
3336
return _Semver(0, 0)
3437
return _Semver(int(splits[0]), int(splits[1]))
3538

google/cloud/pubsublite/internal/wire/single_partition_publisher.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import asyncio
1616
from typing import Optional, List, Iterable
1717

18-
from absl import logging
18+
import logging
1919
from google.cloud.pubsub_v1.types import BatchSettings
2020

2121
from google.cloud.pubsublite.internal.wait_ignore_cancelled import wait_ignore_errors
@@ -43,6 +43,8 @@
4343
)
4444
from google.cloud.pubsublite.internal.wire.work_item import WorkItem
4545

46+
_LOGGER = logging.getLogger(__name__)
47+
4648
# Maximum bytes per batch at 3.5 MiB to avoid GRPC limit of 4 MiB
4749
_MAX_BYTES = int(3.5 * 1024 * 1024)
4850

@@ -156,7 +158,7 @@ async def _flush(self):
156158
try:
157159
await self._connection.write(aggregate)
158160
except GoogleAPICallError as e:
159-
logging.debug(f"Failed publish on stream: {e}")
161+
_LOGGER.debug(f"Failed publish on stream: {e}")
160162
self._fail_if_retrying_failed()
161163

162164
async def publish(self, message: PubSubMessage) -> MessageMetadata:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
dependencies = [
3131
"google-api-core >= 1.22.0",
32-
"absl-py >= 0.9.0",
3332
"proto-plus >= 0.4.0",
3433
"google-cloud-pubsub >= 2.1.0",
3534
"grpcio",

testing/constraints-3.6.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
77
# Then this file should have foo==1.14.0
88
google-api-core==1.22.0
9-
absl-py==0.9.0
109
proto-plus==0.4.0
1110
google-cloud-pubsub==2.1.0
1211
grpcio==100000.0.0
1312
setuptools==100000.0.0
14-
overrides==100000.0.0
13+
overrides==100000.0.0

0 commit comments

Comments
 (0)